AzeorthCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Unit Class Referenceabstract

#include "Unit.h"

Inheritance diagram for Unit:
WorldObject Object WorldLocation Position Creature Player TempSummon Minion Guardian Puppet Totem Pet

Public Types

typedef std::unordered_set< Unit * > AttackerSet
 
typedef std::set< Unit * > ControlSet
 
typedef std::multimap< uint32, Aura * > AuraMap
 
typedef std::pair< AuraMap::const_iterator, AuraMap::const_iterator > AuraMapBounds
 
typedef std::pair< AuraMap::iterator, AuraMap::iterator > AuraMapBoundsNonConst
 
typedef std::multimap< uint32, AuraApplication * > AuraApplicationMap
 
typedef std::pair< AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator > AuraApplicationMapBounds
 
typedef std::pair< AuraApplicationMap::iterator, AuraApplicationMap::iterator > AuraApplicationMapBoundsNonConst
 
typedef std::multimap< AuraStateType, AuraApplication * > AuraStateAurasMap
 
typedef std::pair< AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator > AuraStateAurasMapBounds
 
typedef std::list< AuraEffect * > AuraEffectList
 
typedef std::list< Aura * > AuraList
 
typedef std::list< AuraApplication * > AuraApplicationList
 
typedef std::list< DiminishingReturnDiminishing
 
typedef GuidUnorderedSet ComboPointHolderSet
 
typedef std::map< uint8, AuraApplication * > VisibleAuraMap
 
typedef std::set< PetAura const * > PetAuraSet
 

Public Member Functions

 ~Unit () override
 
UnitAIGetAI ()
 
void SetAI (UnitAI *newAI)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void CleanupBeforeRemoveFromMap (bool finalCleanup)
 
void CleanupsBeforeDelete (bool finalCleanup=true) override
 
uint32 GetDynamicFlags () const override
 
void ReplaceAllDynamicFlags (uint32 flag) override
 
DiminishingLevels GetDiminishing (DiminishingGroup group)
 
void IncrDiminishing (DiminishingGroup group)
 
float ApplyDiminishingToDuration (DiminishingGroup group, int32 &duration, Unit *caster, DiminishingLevels Level, int32 limitduration)
 
void ApplyDiminishingAura (DiminishingGroup group, bool apply)
 
void ClearDiminishings ()
 
float GetSpellMaxRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float GetSpellMinRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
void Update (uint32 time) override
 
void setAttackTimer (WeaponAttackType type, int32 time)
 
void resetAttackTimer (WeaponAttackType type=BASE_ATTACK)
 
int32 getAttackTimer (WeaponAttackType type) const
 
bool isAttackReady (WeaponAttackType type=BASE_ATTACK) const
 
bool haveOffhandWeapon () const
 
bool CanDualWield () const
 
virtual void SetCanDualWield (bool value)
 
float GetCombatReach () const override
 
float GetMeleeReach () const
 
bool IsWithinRange (Unit const *obj, float dist) const
 
bool IsWithinCombatRange (Unit const *obj, float dist2compare) const
 
bool IsWithinMeleeRange (Unit const *obj, float dist=0.f) const
 
float GetMeleeRange (Unit const *target) const
 
virtual SpellSchoolMask GetMeleeDamageSchoolMask (WeaponAttackType attackType=BASE_ATTACK, uint8 damageIndex=0) const =0
 
bool GetRandomContactPoint (Unit const *target, float &x, float &y, float &z, bool force=false) const
 
void _addAttacker (Unit *pAttacker)
 
void _removeAttacker (Unit *pAttacker)
 
UnitgetAttackerForHelper () const
 
bool Attack (Unit *victim, bool meleeAttack)
 
void CastStop (uint32 except_spellid=0, bool withInstant=true)
 
bool AttackStop ()
 
void RemoveAllAttackers ()
 
AttackerSet const & getAttackers () const
 
bool GetMeleeAttackPoint (Unit *attacker, Position &pos)
 
bool isAttackingPlayer () const
 
UnitGetVictim () const
 
void CombatStop (bool includingCast=false)
 
void CombatStopWithPets (bool includingCast=false)
 
void StopAttackFaction (uint32 faction_id)
 
void StopAttackingInvalidTarget ()
 
UnitSelectNearbyTarget (Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
 
UnitSelectNearbyNoTotemTarget (Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
 
void SendMeleeAttackStop (Unit *victim=nullptr)
 
void SendMeleeAttackStart (Unit *victim, Player *sendTo=nullptr)
 
void AddUnitState (uint32 f)
 
bool HasUnitState (const uint32 f) const
 
void ClearUnitState (uint32 f)
 
uint32 GetUnitState () const
 
bool CanFreeMove () const
 
uint32 HasUnitTypeMask (uint32 mask) const
 
void AddUnitTypeMask (uint32 mask)
 
uint32 GetUnitTypeMask () const
 
bool IsSummon () const
 
bool IsGuardian () const
 
bool IsControllableGuardian () const
 
bool IsPet () const
 
bool IsHunterPet () const
 
bool IsTotem () const
 
bool IsVehicle () const
 
uint8 getLevel () const
 
uint8 GetLevel () const
 
uint8 getLevelForTarget (WorldObject const *) const override
 
void SetLevel (uint8 lvl, bool showLevelChange=true)
 
uint8 getRace (bool original=false) const
 
void setRace (uint8 race)
 
uint32 getRaceMask () const
 
uint8 getClass () const
 
uint32 getClassMask () const
 
uint8 getGender () const
 
float GetStat (Stats stat) const
 
void SetStat (Stats stat, int32 val)
 
uint32 GetArmor () const
 
void SetArmor (int32 val)
 
uint32 GetResistance (SpellSchools school) const
 
uint32 GetResistance (SpellSchoolMask mask) const
 
void SetResistance (SpellSchools school, int32 val)
 
uint32 GetHealth () const
 
uint32 GetMaxHealth () const
 
bool IsFullHealth () const
 
bool HealthBelowPct (int32 pct) const
 
bool HealthBelowPctDamaged (int32 pct, uint32 damage) const
 
bool HealthAbovePct (int32 pct) const
 
bool HealthAbovePctHealed (int32 pct, uint32 heal) const
 
float GetHealthPct () const
 
uint32 CountPctFromMaxHealth (int32 pct) const
 
uint32 CountPctFromCurHealth (int32 pct) const
 
float GetPowerPct (Powers power) const
 
void SetHealth (uint32 val)
 
void SetMaxHealth (uint32 val)
 
void SetFullHealth ()
 
int32 ModifyHealth (int32 val)
 
int32 GetHealthGain (int32 dVal)
 
Powers getPowerType () const
 
void setPowerType (Powers power)
 
uint32 GetPower (Powers power) const
 
uint32 GetMaxPower (Powers power) const
 
void SetPower (Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
 
void SetMaxPower (Powers power, uint32 val)
 
int32 ModifyPower (Powers power, int32 val, bool withPowerUpdate=true)
 
int32 ModifyPowerPct (Powers power, float pct, bool apply=true)
 
uint32 GetAttackTime (WeaponAttackType att) const
 
void SetAttackTime (WeaponAttackType att, uint32 val)
 
void ApplyAttackTimePercentMod (WeaponAttackType att, float val, bool apply)
 
void ApplyCastTimePercentMod (float val, bool apply)
 
UnitFlags GetUnitFlags () const
 
bool HasUnitFlag (UnitFlags flags) const
 
void SetUnitFlag (UnitFlags flags)
 
void RemoveUnitFlag (UnitFlags flags)
 
void ReplaceAllUnitFlags (UnitFlags flags)
 
UnitFlags2 GetUnitFlags2 () const
 
bool HasUnitFlag2 (UnitFlags2 flags) const
 
void SetUnitFlag2 (UnitFlags2 flags)
 
void RemoveUnitFlag2 (UnitFlags2 flags)
 
void ReplaceAllUnitFlags2 (UnitFlags2 flags)
 
SheathState GetSheath () const
 
virtual void SetSheath (SheathState sheathed)
 
uint32 GetFaction () const
 
void SetFaction (uint32 faction)
 
FactionTemplateEntry const * GetFactionTemplateEntry () const
 
ReputationRank GetReactionTo (Unit const *target, bool checkOriginalFaction=false) const
 
ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, Unit const *target) const
 
bool IsHostileTo (Unit const *unit) const
 
bool IsHostileToPlayers () const
 
bool IsFriendlyTo (Unit const *unit) const
 
bool IsNeutralToAll () const
 
bool IsInPartyWith (Unit const *unit) const
 
bool IsInRaidWith (Unit const *unit) const
 
void GetPartyMembers (std::list< Unit * > &units)
 
bool IsContestedGuard () const
 
bool IsInSanctuary () const
 
bool IsPvP () const
 
bool IsFFAPvP () const
 
void SetPvP (bool state)
 
uint32 GetCreatureType () const
 
uint32 GetCreatureTypeMask () const
 
uint8 getStandState () const
 
bool IsSitState () const
 
bool IsStandState () const
 
void SetStandState (uint8 state)
 
void SetStandFlags (uint8 flags)
 
void RemoveStandFlags (uint8 flags)
 
bool IsMounted () const
 
uint32 GetMountID () const
 
void Mount (uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
 
void Dismount ()
 
uint16 GetMaxSkillValueForLevel (Unit const *target=nullptr) const
 
void KillSelf (bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
 
void ProcDamageAndSpellFor (bool isVictim, Unit *target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const *procSpellInfo, uint32 damage, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
 
void GetProcAurasTriggeredOnEvent (std::list< AuraApplication * > &aurasTriggeringProc, std::list< AuraApplication * > *procAuras, ProcEventInfo eventInfo)
 
void TriggerAurasProcOnEvent (CalcDamageInfo &damageInfo)
 
void TriggerAurasProcOnEvent (std::list< AuraApplication * > *myProcAuras, std::list< AuraApplication * > *targetProcAuras, Unit *actionTarget, uint32 typeMaskActor, uint32 typeMaskActionTarget, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell *spell, DamageInfo *damageInfo, HealInfo *healInfo)
 
void TriggerAurasProcOnEvent (ProcEventInfo &eventInfo, std::list< AuraApplication * > &procAuras)
 
void HandleEmoteCommand (uint32 emoteId)
 
void AttackerStateUpdate (Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false, bool ignoreCasting=false)
 
void CalculateMeleeDamage (Unit *victim, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK, const bool sittingVictim=false)
 
void DealMeleeDamage (CalcDamageInfo *damageInfo, bool durabilityLoss)
 
void HandleProcExtraAttackFor (Unit *victim, uint32 count)
 
void SetLastExtraAttackSpell (uint32 spellId)
 
uint32 GetLastExtraAttackSpell () const
 
void AddExtraAttacks (uint32 count)
 
void SetLastDamagedTargetGuid (ObjectGuid const &guid)
 
ObjectGuid const & GetLastDamagedTargetGuid () const
 
void CalculateSpellDamageTaken (SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false)
 
void DealSpellDamage (SpellNonMeleeDamage *damageInfo, bool durabilityLoss, Spell const *spell=nullptr)
 
float GetMeleeCritChanceReduction () const
 
float GetRangedCritChanceReduction () const
 
float GetSpellCritChanceReduction () const
 
uint32 GetMeleeCritDamageReduction (uint32 damage) const
 
uint32 GetRangedCritDamageReduction (uint32 damage) const
 
uint32 GetSpellCritDamageReduction (uint32 damage) const
 
uint32 GetMeleeDamageReduction (uint32 damage) const
 
uint32 GetRangedDamageReduction (uint32 damage) const
 
uint32 GetSpellDamageReduction (uint32 damage) const
 
float MeleeSpellMissChance (Unit const *victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
 
SpellMissInfo MeleeSpellHitResult (Unit *victim, SpellInfo const *spell)
 
SpellMissInfo MagicSpellHitResult (Unit *victim, SpellInfo const *spell)
 
SpellMissInfo SpellHitResult (Unit *victim, SpellInfo const *spell, bool canReflect=false)
 
SpellMissInfo SpellHitResult (Unit *victim, Spell const *spell, bool canReflect=false)
 
float GetUnitDodgeChance () const
 
float GetUnitParryChance () const
 
float GetUnitBlockChance () const
 
float GetUnitMissChance (WeaponAttackType attType) const
 
float GetUnitCriticalChance (WeaponAttackType attackType, Unit const *victim) const
 
int32 GetMechanicResistChance (SpellInfo const *spell)
 
bool CanUseAttackType (uint8 attacktype) const
 
virtual uint32 GetShieldBlockValue () const =0
 
uint32 GetShieldBlockValue (uint32 soft_cap, uint32 hard_cap) const
 
uint32 GetUnitMeleeSkill (Unit const *target=nullptr) const
 
uint32 GetDefenseSkillValue (Unit const *target=nullptr) const
 
uint32 GetWeaponSkillValue (WeaponAttackType attType, Unit const *target=nullptr) const
 
float GetWeaponProcChance () const
 
float GetPPMProcChance (uint32 WeaponSpeed, float PPM, SpellInfo const *spellProto) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (Unit const *victim, WeaponAttackType attType) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (Unit const *victim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const
 
NPCFlags GetNpcFlags () const
 
bool HasNpcFlag (NPCFlags flags) const
 
void SetNpcFlag (NPCFlags flags)
 
void RemoveNpcFlag (NPCFlags flags)
 
void ReplaceAllNpcFlags (NPCFlags flags)
 
bool IsVendor () const
 
bool IsTrainer () const
 
bool IsQuestGiver () const
 
bool IsGossip () const
 
bool IsTaxi () const
 
bool IsGuildMaster () const
 
bool IsBattleMaster () const
 
bool IsBanker () const
 
bool IsInnkeeper () const
 
bool IsSpiritHealer () const
 
bool IsSpiritGuide () const
 
bool IsTabardDesigner () const
 
bool IsAuctioner () const
 
bool IsArmorer () const
 
bool IsServiceProvider () const
 
bool IsSpiritService () const
 
bool IsCritter () const
 
bool IsInFlight () const
 
void SetImmuneToAll (bool apply, bool keepCombat=false)
 
bool IsImmuneToAll () const
 
void SetImmuneToPC (bool apply, bool keepCombat=false)
 
bool IsImmuneToPC () const
 
void SetImmuneToNPC (bool apply, bool keepCombat=false)
 
bool IsImmuneToNPC () const
 
bool IsEngaged () const
 
bool IsEngagedBy (Unit const *who) const
 
bool IsInCombat () const
 
bool IsInCombatWith (Unit const *who) const
 
bool IsPetInCombat () const
 
void CombatStart (Unit *target, bool initialAggro=true)
 
void CombatStartOnCast (Unit *target, bool initialAggro=true, uint32 duration=0)
 
void SetInCombatState (bool PvP, Unit *enemy=nullptr, uint32 duration=0)
 
void SetInCombatWith (Unit *enemy, uint32 duration=0)
 
void ClearInCombat ()
 
void ClearInPetCombat ()
 
uint32 GetCombatTimer () const
 
void SetCombatTimer (uint32 timer)
 
bool HasAuraTypeWithFamilyFlags (AuraType auraType, uint32 familyName, uint32 familyFlags) const
 
virtual bool HasSpell (uint32) const
 
bool HasBreakableByDamageAuraType (AuraType type, uint32 excludeAura=0) const
 
bool HasBreakableByDamageCrowdControlAura (Unit *excludeCasterChannel=nullptr) const
 
bool HasStealthAura () const
 
bool HasInvisibilityAura () const
 
bool isFeared () const
 
bool isInRoots () const
 
bool IsPolymorphed () const
 
bool isFrozen () const
 
bool isTargetableForAttack (bool checkFakeDeath=true, Unit const *byWho=nullptr) const
 
bool IsValidAttackTarget (Unit const *target, SpellInfo const *bySpell=nullptr) const
 
bool _IsValidAttackTarget (Unit const *target, SpellInfo const *bySpell, WorldObject const *obj=nullptr) const
 
bool IsValidAssistTarget (Unit const *target) const
 
bool _IsValidAssistTarget (Unit const *target, SpellInfo const *bySpell) const
 
virtual bool IsInWater () const
 
virtual bool IsUnderWater () const
 
bool isInAccessiblePlaceFor (Creature const *c) const
 
void SendHealSpellLog (Unit *victim, uint32 SpellID, uint32 Damage, uint32 OverHeal, uint32 Absorb, bool critical=false)
 
int32 HealBySpell (HealInfo &healInfo, bool critical=false)
 
void SendEnergizeSpellLog (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
void EnergizeBySpell (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
SpellCastResult CastSpell (SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, uint32 spellId, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, SpellInfo const *spellInfo, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, SpellInfo const *spellInfo, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (float x, float y, float z, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (GameObject *go, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim=nullptr, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, CustomSpellValues const &value, Unit *victim=nullptr, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
AuraAddAura (uint32 spellId, Unit *target)
 
AuraAddAura (SpellInfo const *spellInfo, uint8 effMask, Unit *target)
 
void SetAuraStack (uint32 spellId, Unit *target, uint32 stack)
 
void SendPlaySpellVisual (uint32 id)
 
void SendPlaySpellImpact (ObjectGuid guid, uint32 id)
 
void BuildCooldownPacket (WorldPacket &data, uint8 flags, uint32 spellId, uint32 cooldown)
 
void BuildCooldownPacket (WorldPacket &data, uint8 flags, PacketCooldowns const &cooldowns)
 
void DeMorph ()
 
void SendAttackStateUpdate (CalcDamageInfo *damageInfo)
 
void SendAttackStateUpdate (uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount)
 
void SendSpellNonMeleeDamageLog (SpellNonMeleeDamage *log)
 
void SendSpellNonMeleeReflectLog (SpellNonMeleeDamage *log, Unit *attacker)
 
void SendSpellNonMeleeDamageLog (Unit *target, SpellInfo const *spellInfo, uint32 Damage, SpellSchoolMask damageSchoolMask, uint32 AbsorbedDamage, uint32 Resist, bool PhysicalDamage, uint32 Blocked, bool CriticalHit=false, bool Split=false)
 
void SendPeriodicAuraLog (SpellPeriodicAuraLogInfo *pInfo)
 
void SendSpellMiss (Unit *target, uint32 spellID, SpellMissInfo missInfo)
 
void SendSpellDamageResist (Unit *target, uint32 spellId)
 
void SendSpellDamageImmune (Unit *target, uint32 spellId)
 
void NearTeleportTo (Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
 
void NearTeleportTo (float x, float y, float z, float orientation, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
 
void SendTameFailure (uint8 result)
 
void SendTeleportPacket (Position &pos)
 
virtual bool UpdatePosition (float x, float y, float z, float ang, bool teleport=false)
 
bool UpdatePosition (const Position &pos, bool teleport=false)
 
void UpdateOrientation (float orientation)
 Only server-side orientation update, does not broadcast to client. More...
 
void UpdateHeight (float newZ)
 Only server-side height update, does not broadcast to client. More...
 
void KnockbackFrom (float x, float y, float speedXY, float speedZ)
 
void JumpTo (float speedXY, float speedZ, bool forward=true)
 
void JumpTo (WorldObject *obj, float speedZ)
 
void SendMonsterMove (float NewPosX, float NewPosY, float NewPosZ, uint32 TransitTime, SplineFlags sf=SPLINEFLAG_WALK_MODE)
 
void MonsterMoveWithSpeed (float x, float y, float z, float speed)
 
void SendMovementFlagUpdate (bool self=false)
 
virtual bool SetWalk (bool enable)
 
virtual bool SetDisableGravity (bool disable, bool packetOnly=false, bool updateAnimationTier=true)
 
virtual bool SetSwim (bool enable)
 
virtual bool SetCanFly (bool enable, bool packetOnly=false)
 
virtual bool SetWaterWalking (bool enable, bool packetOnly=false)
 
virtual bool SetFeatherFall (bool enable, bool packetOnly=false)
 
virtual bool SetHover (bool enable, bool packetOnly=false, bool updateAnimationTier=true)
 
void SendMovementWaterWalking (Player *sendTo)
 
void SendMovementFeatherFall (Player *sendTo)
 
void SendMovementHover (Player *sendTo)
 
void SetInFront (WorldObject const *target)
 
void SetFacingTo (float ori)
 
void SetFacingToObject (WorldObject *object)
 
void SendChangeCurrentVictimOpcode (HostileReference *pHostileReference)
 
void SendClearThreatListOpcode ()
 
void SendRemoveFromThreatListOpcode (HostileReference *pHostileReference)
 
void SendThreatListUpdate ()
 
void SendClearTarget ()
 
void BuildHeartBeatMsg (WorldPacket *data) const
 
bool IsAlive () const
 
bool isDying () const
 
bool isDead () const
 
DeathState getDeathState ()
 
virtual void setDeathState (DeathState s, bool despawn=false)
 
ObjectGuid GetOwnerGUID () const
 
void SetOwnerGUID (ObjectGuid owner)
 
ObjectGuid GetCreatorGUID () const
 
void SetCreatorGUID (ObjectGuid creator)
 
ObjectGuid GetMinionGUID () const
 
void SetMinionGUID (ObjectGuid guid)
 
ObjectGuid GetCharmerGUID () const
 
void SetCharmerGUID (ObjectGuid owner)
 
ObjectGuid GetCharmGUID () const
 
void SetPetGUID (ObjectGuid guid)
 
ObjectGuid GetPetGUID () const
 
void SetCritterGUID (ObjectGuid guid)
 
ObjectGuid GetCritterGUID () const
 
bool IsControlledByPlayer () const
 
bool IsCreatedByPlayer () const
 
ObjectGuid GetCharmerOrOwnerGUID () const
 
ObjectGuid GetCharmerOrOwnerOrOwnGUID () const
 
bool IsCharmedOwnedByPlayerOrPlayer () const
 
PlayerGetSpellModOwner () const
 
UnitGetOwner () const
 
GuardianGetGuardianPet () const
 
MinionGetFirstMinion () const
 
UnitGetCharmer () const
 
UnitGetCharm () const
 
UnitGetCharmerOrOwner () const
 
UnitGetCharmerOrOwnerOrSelf () const
 
PlayerGetCharmerOrOwnerPlayerOrPlayerItself () const
 
PlayerGetAffectingPlayer () const
 
void SetMinion (Minion *minion, bool apply)
 
void GetAllMinionsByEntry (std::list< Creature * > &Minions, uint32 entry)
 
void RemoveAllMinionsByEntry (uint32 entry)
 
void SetCharm (Unit *target, bool apply)
 
UnitGetNextRandomRaidMemberOrPet (float radius)
 
bool SetCharmedBy (Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
 
void RemoveCharmedBy (Unit *charmer)
 
void RestoreFaction ()
 
UnitGetFirstControlled () const
 
void RemoveAllControlled (bool onDeath=false)
 
bool IsCharmed () const
 
bool isPossessed () const
 
bool isPossessedByPlayer () const
 
bool isPossessing () const
 
bool isPossessing (Unit *u) const
 
CharmInfoGetCharmInfo ()
 
CharmInfoInitCharmInfo ()
 
void DeleteCharmInfo ()
 
void UpdateCharmAI ()
 
SharedVisionList const & GetSharedVisionList ()
 
void AddPlayerToVision (Player *player)
 
void RemovePlayerFromVision (Player *player)
 
bool HasSharedVision () const
 
void RemoveBindSightAuras ()
 
void RemoveCharmAuras ()
 
PetCreateTamedPetFrom (Creature *creatureTarget, uint32 spell_id=0)
 
PetCreateTamedPetFrom (uint32 creatureEntry, uint32 spell_id=0)
 
bool InitTamedPet (Pet *pet, uint8 level, uint32 spell_id)
 
Aura_TryStackingOrRefreshingExistingAura (SpellInfo const *newAura, uint8 effMask, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, bool periodicReset=false)
 
void _AddAura (UnitAura *aura, Unit *caster)
 
AuraApplication_CreateAuraApplication (Aura *aura, uint8 effMask)
 
void _ApplyAuraEffect (Aura *aura, uint8 effIndex)
 
void _ApplyAura (AuraApplication *aurApp, uint8 effMask)
 
void _UnapplyAura (AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
 
void _UnapplyAura (AuraApplication *aurApp, AuraRemoveMode removeMode)
 
void _RemoveNoStackAuraApplicationsDueToAura (Aura *aura)
 
void _RemoveNoStackAurasDueToAura (Aura *aura)
 
bool _IsNoStackAuraDueToAura (Aura *appliedAura, Aura *existingAura) const
 
void _RegisterAuraEffect (AuraEffect *aurEff, bool apply)
 
AuraMapGetOwnedAuras ()
 
AuraMap const & GetOwnedAuras () const
 
void RemoveOwnedAura (AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (Aura *aura, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
AuraGetOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, Aura *except=nullptr) const
 
AuraApplicationMapGetAppliedAuras ()
 
AuraApplicationMap const & GetAppliedAuras () const
 
void RemoveAura (AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (AuraApplication *aurApp, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (Aura *aur, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAppliedAuras (std::function< bool(AuraApplication const *)> const &check)
 
void RemoveOwnedAuras (std::function< bool(Aura const *)> const &check)
 
void RemoveAppliedAuras (uint32 spellId, std::function< bool(AuraApplication const *)> const &check)
 
void RemoveOwnedAuras (uint32 spellId, std::function< bool(Aura const *)> const &check)
 
void RemoveAurasDueToSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAuraFromStack (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAurasDueToSpellByDispel (uint32 spellId, uint32 dispellerSpellId, ObjectGuid casterGUID, Unit *dispeller, uint8 chargesRemoved=1)
 
void RemoveAurasDueToSpellBySteal (uint32 spellId, ObjectGuid casterGUID, Unit *stealer)
 
void RemoveAurasDueToItemSpell (uint32 spellId, ObjectGuid castItemGuid)
 
void RemoveAurasByType (AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
 
void RemoveNotOwnSingleTargetAuras ()
 
void RemoveAurasWithInterruptFlags (uint32 flag, uint32 except=0, bool isAutoshot=false)
 
void RemoveAurasWithAttribute (uint32 flags)
 
void RemoveAurasWithFamily (SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID)
 
void RemoveAurasWithMechanic (uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
 
void RemoveMovementImpairingAuras (bool withRoot)
 
void RemoveAurasByShapeShift ()
 
void RemoveAreaAurasDueToLeaveWorld ()
 
void RemoveAllAuras ()
 
void RemoveArenaAuras ()
 
void RemoveAllAurasOnDeath ()
 
void RemoveAllAurasRequiringDeadTarget ()
 
void RemoveAllAurasExceptType (AuraType type)
 
void RemoveEvadeAuras ()
 
void DelayOwnedAuras (uint32 spellId, ObjectGuid caster, int32 delaytime)
 
void _RemoveAllAuraStatMods ()
 
void _ApplyAllAuraStatMods ()
 
AuraEffectList const & GetAuraEffectsByType (AuraType type) const
 
AuraListGetSingleCastAuras ()
 
AuraList const & GetSingleCastAuras () const
 
AuraEffectGetAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffectOfRankedSpell (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffect (AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraEffectGetAuraEffect (AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffectDummy (uint32 spellid) const
 
AuraEffectGetDummyAuraEffect (SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraApplicationGetAuraApplication (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
 
AuraGetAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
AuraApplicationGetAuraApplicationOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
 
AuraGetAuraOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
void GetDispellableAuraList (Unit *caster, uint32 dispelMask, DispelChargesList &dispelList)
 
bool HasAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
 
uint32 GetAuraCount (uint32 spellId) const
 
bool HasAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
bool HasAuraType (AuraType auraType) const
 
bool HasAuraTypeWithCaster (AuraType auratype, ObjectGuid caster) const
 
bool HasAuraTypeWithMiscvalue (AuraType auratype, int32 miscvalue) const
 
bool HasAuraTypeWithAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
bool HasAuraTypeWithValue (AuraType auratype, int32 value) const
 
bool HasAuraTypeWithTriggerSpell (AuraType auratype, uint32 triggerSpell) const
 
bool HasNegativeAuraWithInterruptFlag (uint32 flag, ObjectGuid guid=ObjectGuid::Empty)
 
bool HasVisibleAuraType (AuraType auraType) const
 
bool HasNegativeAuraWithAttribute (uint32 flag, ObjectGuid guid=ObjectGuid::Empty)
 
bool HasAuraWithMechanic (uint32 mechanicMask) const
 
AuraEffectIsScriptOverriden (SpellInfo const *spell, int32 script) const
 
uint32 GetDiseasesByCaster (ObjectGuid casterGUID, uint8 mode=0)
 
uint32 GetDoTsByCaster (ObjectGuid casterGUID) const
 
int32 GetTotalAuraModifierAreaExclusive (AuraType auratype) const
 
int32 GetTotalAuraModifier (AuraType auratype) const
 
float GetTotalAuraMultiplier (AuraType auratype) const
 
int32 GetMaxPositiveAuraModifier (AuraType auratype)
 
int32 GetMaxNegativeAuraModifier (AuraType auratype) const
 
int32 GetTotalAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
float GetTotalAuraMultiplierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
int32 GetMaxPositiveAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask, const AuraEffect *except=nullptr) const
 
int32 GetMaxNegativeAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
int32 GetTotalAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
float GetTotalAuraMultiplierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetMaxPositiveAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetMaxNegativeAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetTotalAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
float GetTotalAuraMultiplierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
int32 GetMaxPositiveAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
int32 GetMaxNegativeAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
float GetResistanceBuffMods (SpellSchools school, bool positive) const
 
void SetResistanceBuffMods (SpellSchools school, bool positive, float val)
 
void ApplyResistanceBuffModsMod (SpellSchools school, bool positive, float val, bool apply)
 
void ApplyResistanceBuffModsPercentMod (SpellSchools school, bool positive, float val, bool apply)
 
void InitStatBuffMods ()
 
void ApplyStatBuffMod (Stats stat, float val, bool apply)
 
void ApplyStatPercentBuffMod (Stats stat, float val, bool apply)
 
void SetCreateStat (Stats stat, float val)
 
void SetCreateHealth (uint32 val)
 
uint32 GetCreateHealth () const
 
void SetCreateMana (uint32 val)
 
uint32 GetCreateMana () const
 
uint32 GetCreatePowers (Powers power) const
 
float GetPosStat (Stats stat) const
 
float GetNegStat (Stats stat) const
 
float GetCreateStat (Stats stat) const
 
void SetCurrentCastedSpell (Spell *pSpell)
 
virtual void ProhibitSpellSchool (SpellSchoolMask, uint32)
 
void InterruptSpell (CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
 
void FinishSpell (CurrentSpellTypes spellType, bool ok=true)
 
bool IsNonMeleeSpellCast (bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
 
void InterruptNonMeleeSpells (bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
 
SpellGetCurrentSpell (CurrentSpellTypes spellType) const
 
SpellGetCurrentSpell (uint32 spellType) const
 
SpellFindCurrentSpellBySpellId (uint32 spell_id) const
 
int32 GetCurrentSpellCastTime (uint32 spell_id) const
 
virtual bool IsMovementPreventedByCasting () const
 
ShapeshiftForm GetShapeshiftForm () const
 
void SetShapeshiftForm (ShapeshiftForm form)
 
bool IsInFeralForm () const
 
bool IsInDisallowedMountForm () const
 
bool HandleStatModifier (UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
 
void SetModifierValue (UnitMods unitMod, UnitModifierType modifierType, float value)
 
float GetModifierValue (UnitMods unitMod, UnitModifierType modifierType) const
 
float GetTotalStatValue (Stats stat, float additionalValue=0.0f) const
 
float GetTotalAuraModValue (UnitMods unitMod) const
 
SpellSchools GetSpellSchoolByAuraGroup (UnitMods unitMod) const
 
Stats GetStatByAuraGroup (UnitMods unitMod) const
 
Powers GetPowerTypeByAuraGroup (UnitMods unitMod) const
 
bool CanModifyStats () const
 
void SetCanModifyStats (bool modifyStats)
 
virtual bool UpdateStats (Stats stat)=0
 
virtual bool UpdateAllStats ()=0
 
virtual void UpdateResistances (uint32 school)=0
 
virtual void UpdateAllResistances ()
 
virtual void UpdateArmor ()=0
 
virtual void UpdateMaxHealth ()=0
 
virtual void UpdateMaxPower (Powers power)=0
 
virtual void UpdateAttackPowerAndDamage (bool ranged=false)=0
 
virtual void UpdateDamagePhysical (WeaponAttackType attType)
 
float GetTotalAttackPowerValue (WeaponAttackType attType, Unit *pVictim=nullptr) const
 
float GetWeaponDamageRange (WeaponAttackType attType, WeaponDamageRange type, uint8 damageIndex=0) const
 
void SetBaseWeaponDamage (WeaponAttackType attType, WeaponDamageRange damageRange, float value, uint8 damageIndex=0)
 
virtual void CalculateMinMaxDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage, uint8 damageIndex=0)=0
 
uint32 CalculateDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, uint8 itemDamagesMask=0)
 
float GetAPMultiplier (WeaponAttackType attType, bool normalized)
 
bool isInFrontInMap (Unit const *target, float distance, float arc=M_PI) const
 
bool isInBackInMap (Unit const *target, float distance, float arc=M_PI) const
 
bool IsVisible () const
 
void SetVisible (bool x)
 
void SetModelVisible (bool on)
 
uint32 GetPhaseByAuras () const
 
void SetPhaseMask (uint32 newPhaseMask, bool update) override
 
void UpdateObjectVisibility (bool forced=true, bool fromUpdate=false) override
 
bool CanHaveThreatList () const
 
void AddThreat (Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
 
float ApplyTotalThreatModifier (float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
void TauntApply (Unit *victim)
 
void TauntFadeOut (Unit *taunter)
 
ThreatMgrGetThreatMgr ()
 
ThreatMgr const & GetThreatMgr () const
 
void addHatedBy (HostileReference *pHostileReference)
 
void removeHatedBy (HostileReference *)
 
HostileRefMgrgetHostileRefMgr ()
 
VisibleAuraMap const * GetVisibleAuras ()
 
AuraApplicationGetVisibleAura (uint8 slot)
 
void SetVisibleAura (uint8 slot, AuraApplication *aur)
 
void RemoveVisibleAura (uint8 slot)
 
uint32 GetInterruptMask () const
 
void AddInterruptMask (uint32 mask)
 
void UpdateInterruptMask ()
 
virtual float GetNativeObjectScale () const
 
virtual void RecalculateObjectScale ()
 
uint32 GetDisplayId () const
 
virtual void SetDisplayId (uint32 modelId)
 
uint32 GetNativeDisplayId () const
 
void RestoreDisplayId ()
 
void SetNativeDisplayId (uint32 modelId)
 
void setTransForm (uint32 spellid)
 
uint32 getTransForm () const
 
void _RegisterDynObject (DynamicObject *dynObj)
 
void _UnregisterDynObject (DynamicObject *dynObj)
 
DynamicObjectGetDynObject (uint32 spellId)
 
bool RemoveDynObject (uint32 spellId)
 
void RemoveAllDynObjects ()
 
GameObjectGetGameObject (uint32 spellId) const
 
void AddGameObject (GameObject *gameObj)
 
void RemoveGameObject (GameObject *gameObj, bool del)
 
void RemoveGameObject (uint32 spellid, bool del)
 
void RemoveAllGameObjects ()
 
void ModifyAuraState (AuraStateType flag, bool apply)
 
uint32 BuildAuraStateUpdateForTarget (Unit *target) const
 
bool HasAuraState (AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
 
void UnsummonAllTotems (bool onDeath=false)
 
UnitGetMagicHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
UnitGetMeleeHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo=nullptr)
 
int32 SpellBaseDamageBonusDone (SpellSchoolMask schoolMask)
 
int32 SpellBaseDamageBonusTaken (SpellSchoolMask schoolMask, bool isDoT=false)
 
float SpellPctDamageModsDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
 
uint32 SpellDamageBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
 
uint32 SpellDamageBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1)
 
int32 SpellBaseHealingBonusDone (SpellSchoolMask schoolMask)
 
int32 SpellBaseHealingBonusTaken (SpellSchoolMask schoolMask)
 
float SpellPctHealingModsDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
 
uint32 SpellHealingBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
 
uint32 SpellHealingBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack=1)
 
uint32 MeleeDamageBonusDone (Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
uint32 MeleeDamageBonusTaken (Unit *attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
bool isSpellBlocked (Unit *victim, SpellInfo const *spellProto, WeaponAttackType attackType=BASE_ATTACK)
 
bool isBlockCritical ()
 
float SpellDoneCritChance (Unit const *, SpellInfo const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType, bool skipEffectCheck) const
 
float SpellTakenCritChance (Unit const *caster, SpellInfo const *spellProto, SpellSchoolMask schoolMask, float doneChance, WeaponAttackType attackType, bool skipEffectCheck) const
 
void SetLastManaUse (uint32 spellCastTime)
 
bool IsUnderLastManaUseEffect () const
 
void SetContestedPvP (Player *attackedPlayer=nullptr, bool lookForNearContestedGuards=true)
 
uint32 GetCastingTimeForBonus (SpellInfo const *spellProto, DamageEffectType damagetype, uint32 CastingTime) const
 
float CalculateDefaultCoefficient (SpellInfo const *spellInfo, DamageEffectType damagetype) const
 
void CastDelayedSpellWithPeriodicAmount (Unit *caster, uint32 spellId, AuraType auraType, int32 addAmount, uint8 effectIndex=0)
 
void ApplySpellImmune (uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
 
void ApplySpellDispelImmunity (SpellInfo const *spellProto, DispelType type, bool apply)
 
virtual bool IsImmunedToSpell (SpellInfo const *spellInfo, Spell const *spell=nullptr)
 
bool IsImmunedToDamage (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToDamage (SpellInfo const *spellInfo) const
 
bool IsImmunedToDamage (Spell const *spell) const
 
bool IsImmunedToSchool (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToSchool (SpellInfo const *spellInfo) const
 
bool IsImmunedToSchool (Spell const *spell) const
 
bool IsImmunedToDamageOrSchool (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToDamageOrSchool (SpellInfo const *spellInfo) const
 
virtual bool IsImmunedToSpellEffect (SpellInfo const *spellInfo, uint32 index) const
 
void UpdateSpeed (UnitMoveType mtype, bool forced)
 
float GetSpeed (UnitMoveType mtype) const
 
float GetSpeedRate (UnitMoveType mtype) const
 
void SetSpeed (UnitMoveType mtype, float rate, bool forced=false)
 
void SetSpeedRate (UnitMoveType mtype, float rate)
 
float ApplyEffectModifiers (SpellInfo const *spellProto, uint8 effect_index, float value) const
 
int32 CalculateSpellDamage (Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
 
int32 CalcSpellDuration (SpellInfo const *spellProto)
 
int32 ModSpellDuration (SpellInfo const *spellProto, Unit const *target, int32 duration, bool positive, uint32 effectMask)
 
void ModSpellCastTime (SpellInfo const *spellProto, int32 &castTime, Spell *spell=nullptr)
 
float CalculateLevelPenalty (SpellInfo const *spellProto) const
 
void addFollower (FollowerReference *pRef)
 
void removeFollower (FollowerReference *)
 
MotionMasterGetMotionMaster ()
 
const MotionMasterGetMotionMaster () const
 
virtual MovementGeneratorType GetDefaultMovementType () const
 -------—End of Pet responses methods-------— More...
 
bool IsStopped () const
 
void StopMoving ()
 
void StopMovingOnCurrentPos ()
 
virtual void PauseMovement (uint32 timer=0, uint8 slot=0)
 
void ResumeMovement (uint32 timer=0, uint8 slot=0)
 
void AddUnitMovementFlag (uint32 f)
 
void RemoveUnitMovementFlag (uint32 f)
 
bool HasUnitMovementFlag (uint32 f) const
 
uint32 GetUnitMovementFlags () const
 
void SetUnitMovementFlags (uint32 f)
 
void AddExtraUnitMovementFlag (uint16 f)
 
void RemoveExtraUnitMovementFlag (uint16 f)
 
uint16 HasExtraUnitMovementFlag (uint16 f) const
 
uint16 GetExtraUnitMovementFlags () const
 
void SetExtraUnitMovementFlags (uint16 f)
 
void SetControlled (bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
 
void DisableRotate (bool apply)
 
void DisableSpline ()
 
uint8 GetComboPoints (Unit const *who=nullptr) const
 --------—Combo point system----------------— More...
 
uint8 GetComboPoints (ObjectGuid const &guid) const
 
UnitGetComboTarget () const
 
ObjectGuid const GetComboTargetGUID () const
 
void AddComboPoints (Unit *target, int8 count)
 
void AddComboPoints (int8 count)
 
void ClearComboPoints ()
 
void SendComboPoints ()
 
void AddComboPointHolder (Unit *unit)
 
void RemoveComboPointHolder (Unit *unit)
 
void ClearComboPointHolders ()
 
void SendPetActionFeedback (uint8 msg)
 -------—Pet responses methods--------------— More...
 
void SendPetTalk (uint32 pettalk)
 
void SendPetAIReaction (ObjectGuid guid)
 
void propagateSpeedChange ()
 -------—End of Pet responses methods-------— More...
 
void ClearAllReactives ()
 
void StartReactiveTimer (ReactiveType reactive)
 
void UpdateReactives (uint32 p_time)
 
void UpdateAuraForGroup (uint8 slot)
 
bool CanProc ()
 
void SetCantProc (bool apply)
 
void AddPetAura (PetAura const *petSpell)
 
void RemovePetAura (PetAura const *petSpell)
 
void CastPetAura (PetAura const *aura)
 
bool IsPetAura (Aura const *aura)
 
uint32 GetModelForForm (ShapeshiftForm form, uint32 spellId) const
 
uint32 GetModelForTotem (PlayerTotemType totemType)
 
void SetRedirectThreat (ObjectGuid guid, uint32 pct)
 
void ResetRedirectThreat ()
 
void ModifyRedirectThreat (int32 amount)
 
uint32 GetRedirectThreatPercent ()
 
UnitGetRedirectThreatTarget () const
 
bool CreateVehicleKit (uint32 id, uint32 creatureEntry)
 
void RemoveVehicleKit ()
 
VehicleGetVehicleKit () const
 
VehicleGetVehicle () const
 
bool IsOnVehicle (Unit const *vehicle) const
 
UnitGetVehicleBase () const
 
CreatureGetVehicleCreatureBase () const
 
ObjectGuid GetTransGUID () const override
 
TransportBaseGetDirectTransport () const
 Returns the transport this unit is on directly (if on vehicle and transport, return vehicle) More...
 
bool HandleSpellClick (Unit *clicker, int8 seatId=-1)
 
void EnterVehicle (Unit *base, int8 seatId=-1)
 
void EnterVehicleUnattackable (Unit *base, int8 seatId=-1)
 
void ExitVehicle (Position const *exitPosition=nullptr)
 
void ChangeSeat (int8 seatId, bool next=true)
 
void _ExitVehicle (Position const *exitPosition=nullptr)
 
void _EnterVehicle (Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=nullptr)
 
void BuildMovementPacket (ByteBuffer *data) const
 
virtual bool CanSwim () const
 this method checks the current flag of a unit More...
 
bool IsLevitating () const
 
bool IsWalking () const
 
bool isMoving () const
 
bool isTurning () const
 
bool IsHovering () const
 
bool isSwimming () const
 
virtual bool CanFly () const =0
 
bool IsFlying () const
 
bool IsFalling () const
 
float GetHoverHeight () const
 
virtual bool CanEnterWater () const =0
 
void RewardRage (uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
 
virtual float GetFollowAngle () const
 
void OutDebugInfo () const
 
virtual bool isBeingLoaded () const
 
bool IsDuringRemoveFromWorld () const
 
PetToPet ()
 
TotemToTotem ()
 
TempSummonToTempSummon ()
 
const TempSummonToTempSummon () const
 
void AddPointedBy (SafeUnitPointer *sup)
 
void RemovePointedBy (SafeUnitPointer *sup)
 
void ExecuteDelayedUnitRelocationEvent ()
 
void ExecuteDelayedUnitAINotifyEvent ()
 
virtual bool HasSpellCooldown (uint32) const
 
virtual bool HasSpellItemCooldown (uint32, uint32) const
 
virtual void AddSpellCooldown (uint32, uint32, uint32, bool needSendToClient=false, bool forceSendToSpectator=false)
 
bool CanApplyResilience () const
 
void PetSpellFail (SpellInfo const *spellInfo, Unit *target, uint32 result)
 
int32 CalculateAOEDamageReduction (int32 damage, uint32 schoolMask, Unit *caster) const
 
ObjectGuid GetTarget () const
 
virtual void SetTarget (ObjectGuid=ObjectGuid::Empty)=0
 
void SetInstantCast (bool set)
 
bool CanInstantCast () const
 
virtual void Talk (std::string_view text, ChatMsg msgType, Language language, float textRange, WorldObject const *target)
 
virtual void Say (std::string_view text, Language language, WorldObject const *target=nullptr)
 
virtual void Yell (std::string_view text, Language language, WorldObject const *target=nullptr)
 
virtual void TextEmote (std::string_view text, WorldObject const *target=nullptr, bool isBossEmote=false)
 
virtual void Whisper (std::string_view text, Language language, Player *target, bool isBossWhisper=false)
 
virtual void Talk (uint32 textId, ChatMsg msgType, float textRange, WorldObject const *target)
 
virtual void Say (uint32 textId, WorldObject const *target=nullptr)
 
virtual void Yell (uint32 textId, WorldObject const *target=nullptr)
 
virtual void TextEmote (uint32 textId, WorldObject const *target=nullptr, bool isBossEmote=false)
 
virtual void Whisper (uint32 textId, Player *target, bool isBossWhisper=false)
 
float GetCollisionHeight () const override
 Return collision height sent to client. More...
 
float GetCollisionWidth () const override
 this method gets the diameter of a Unit by DB if any value is defined, otherwise it gets the value by the DBC More...
 
float GetCollisionRadius () const override
 this method gets the radius of a Unit by DB if any value is defined, otherwise it gets the value by the DBC More...
 
void ProcessPositionDataChanged (PositionFullTerrainStatus const &data) override
 
virtual void ProcessTerrainStatusUpdate ()
 
bool CanRestoreMana (SpellInfo const *spellInfo) const
 
std::string GetDebugInfo () const override
 
- Public Member Functions inherited from WorldObject
 ~WorldObject () override
 
virtual void Update (uint32)
 
void _Create (ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void GetNearPoint2D (WorldObject const *searcher, float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint2D (float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint (WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle, float controlZ=0, Position const *startPos=nullptr) const
 
void GetVoidClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0, float controlZ=0) const
 
bool GetClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float angle=0, WorldObject const *forWho=nullptr, bool force=false) const
 
void MovePosition (Position &pos, float dist, float angle)
 
Position GetNearPosition (float dist, float angle)
 
void MovePositionToFirstCollision (Position &pos, float dist, float angle)
 
Position GetFirstCollisionPosition (float startX, float startY, float startZ, float destX, float destY)
 
Position GetFirstCollisionPosition (float destX, float destY, float destZ)
 
Position GetFirstCollisionPosition (float dist, float angle)
 
Position GetRandomNearPosition (float radius)
 
void GetContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
void GetChargeContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
float GetObjectSize () const
 
virtual float GetCombatReach () const
 
void UpdateGroundPositionZ (float x, float y, float &z) const
 
void UpdateAllowedPositionZ (float x, float y, float &z, float *groundZ=nullptr) const
 
void GetRandomPoint (const Position &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
Position GetRandomPoint (const Position &srcPos, float distance) const
 
uint32 GetInstanceId () const
 
virtual void SetPhaseMask (uint32 newPhaseMask, bool update)
 
uint32 GetPhaseMask () const
 
bool InSamePhase (WorldObject const *obj) const
 
bool InSamePhase (uint32 phasemask) const
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid) const
 
bool IsOutdoors () const
 
LiquidData const & GetLiquidData () const
 
InstanceScriptGetInstanceScript () const
 
std::string const & GetName () const
 
void SetName (std::string const &newname)
 
virtual std::string const & GetNameForLocaleIdx (LocaleConstant) const
 
float GetDistance (WorldObject const *obj) const
 
float GetDistance (const Position &pos) const
 
float GetDistance (float x, float y, float z) const
 
float GetDistance2d (WorldObject const *obj) const
 
float GetDistance2d (float x, float y) const
 
float GetDistanceZ (WorldObject const *obj) const
 
bool IsSelfOrInSameMap (WorldObject const *obj) const
 
bool IsInMap (WorldObject const *obj) const
 
bool IsWithinDist3d (float x, float y, float z, float dist) const
 
bool IsWithinDist3d (const Position *pos, float dist) const
 
bool IsWithinDist2d (float x, float y, float dist) const
 
bool IsWithinDist2d (const Position *pos, float dist) const
 
bool IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
 
bool IsWithinLOS (float x, float y, float z, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS) const
 
bool IsWithinLOSInMap (WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
Position GetHitSpherePointFor (Position const &dest, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
void GetHitSpherePointFor (Position const &dest, float &x, float &y, float &z, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
bool GetDistanceOrder (WorldObject const *obj1, WorldObject const *obj2, bool is3D=true) const
 
bool IsInRange (WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
 
bool IsInRange2d (float x, float y, float minRange, float maxRange) const
 
bool IsInRange3d (float x, float y, float z, float minRange, float maxRange) const
 
bool isInFront (WorldObject const *target, float arc=M_PI) const
 
bool isInBack (WorldObject const *target, float arc=M_PI) const
 
bool IsInBetween (WorldObject const *obj1, WorldObject const *obj2, float size=0) const
 
virtual void CleanupsBeforeDelete (bool finalCleanup=true)
 
virtual void SendMessageToSet (WorldPacket const *data, bool self) const
 
virtual void SendMessageToSetInRange (WorldPacket const *data, float dist, bool, bool includeMargin=false, Player const *skipped_rcvr=nullptr) const
 
virtual void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr) const
 
virtual uint8 getLevelForTarget (WorldObject const *) const
 
void PlayDistanceSound (uint32 sound_id, Player *target=nullptr)
 
void PlayDirectSound (uint32 sound_id, Player *target=nullptr)
 
void PlayDirectMusic (uint32 music_id, Player *target=nullptr)
 
void SendObjectDeSpawnAnim (ObjectGuid guid)
 
virtual void SaveRespawnTime ()
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
virtual float GetSightRange (WorldObject const *target=nullptr) const
 
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
 
void SendPlayMusic (uint32 Music, bool OnlySelf)
 
virtual void SetMap (Map *map)
 
virtual void ResetMap ()
 
MapGetMap () const
 
MapFindMap () const
 
void SetZoneScript ()
 
void ClearZoneScript ()
 
ZoneScriptGetZoneScript () const
 
TempSummonSummonCreature (uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
 
TempSummonSummonCreature (uint32 id, float x, float y, float z, float ang=0, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false)
 
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport=true, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
 
CreatureSummonTrigger (float x, float y, float z, float ang, uint32 dur, bool setLevel=false, CreatureAI *(*GetAI)(Creature *)=nullptr)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=nullptr)
 
CreatureFindNearestCreature (uint32 entry, float range, bool alive=true) const
 
GameObjectFindNearestGameObject (uint32 entry, float range, bool onlySpawned=false) const
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
PlayerSelectNearestPlayer (float distance=0) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetDeadCreatureListInGrid (std::list< Creature * > &lList, float maxSearchRange, bool alive=false) const
 
void DestroyForNearbyPlayers ()
 
virtual void UpdateObjectVisibility (bool forced=true, bool fromUpdate=false)
 
void BuildUpdate (UpdateDataMapType &data_map, UpdatePlayerSet &player_set) override
 
void GetCreaturesWithEntryInRange (std::list< Creature * > &creatureList, float radius, uint32 entry)
 
void SetPositionDataUpdate ()
 
void UpdatePositionData ()
 
void AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
void AddToNotify (uint16 f)
 
void RemoveFromNotify (uint16 f)
 
bool isNeedNotify (uint16 f) const
 
uint16 GetNotifyFlags () const
 
bool NotifyExecuted (uint16 f) const
 
void SetNotified (uint16 f)
 
void ResetAllNotifies ()
 
bool isActiveObject () const
 
void setActive (bool isActiveObject)
 
bool IsFarVisible () const
 
bool IsVisibilityOverridden () const
 
void SetVisibilityDistanceOverride (VisibilityDistanceType type)
 
void SetWorldObject (bool apply)
 
bool IsPermanentWorldObject () const
 
bool IsWorldObject () const
 
bool IsInWintergrasp () const
 
TransportGetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
uint32 GetTransTime () const
 
int8 GetTransSeat () const
 
virtual ObjectGuid GetTransGUID () const
 
void SetTransport (Transport *t)
 
virtual float GetStationaryX () const
 
virtual float GetStationaryY () const
 
virtual float GetStationaryZ () const
 
virtual float GetStationaryO () const
 
float GetMapWaterOrGroundLevel (float x, float y, float z, float *ground=nullptr) const
 
float GetMapHeight (float x, float y, float z, bool vmap=true, float distanceToSearch=50.0f) const
 
float GetFloorZ () const
 
float GetMinHeightInWater () const
 Get the minimum height of a object that should be in water to start floating/swim. More...
 
virtual float GetCollisionHeight () const
 
virtual float GetCollisionWidth () const
 
virtual float GetCollisionRadius () const
 
void AddAllowedLooter (ObjectGuid guid)
 
void ResetAllowedLooters ()
 
void SetAllowedLooters (GuidUnorderedSet const looters)
 
bool HasAllowedLooter (ObjectGuid guid) const
 
GuidUnorderedSet const & GetAllowedLooters () const
 
std::string GetDebugInfo () const override
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
virtual void AddToWorld ()
 
virtual void RemoveFromWorld ()
 
ObjectGuid GetGUID () const
 
PackedGuid const & GetPackGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
virtual uint32 GetDynamicFlags () const
 
bool HasDynamicFlag (uint32 flag) const
 
virtual void SetDynamicFlag (uint32 flag)
 
virtual void RemoveDynamicFlag (uint32 flag)
 
virtual void ReplaceAllDynamicFlags (uint32 flag)
 
TypeID GetTypeId () const
 
bool isType (uint16 mask) const
 
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
void BuildMovementUpdateBlock (UpdateData *data, uint32 flags=0) const
 
virtual void DestroyForPlayer (Player *target, bool onDeath=false) const
 
int32 GetInt32Value (uint16 index) const
 
uint32 GetUInt32Value (uint16 index) const
 
uint64 GetUInt64Value (uint16 index) const
 
float GetFloatValue (uint16 index) const
 
uint8 GetByteValue (uint16 index, uint8 offset) const
 
uint16 GetUInt16Value (uint16 index, uint8 offset) const
 
ObjectGuid GetGuidValue (uint16 index) const
 
void SetInt32Value (uint16 index, int32 value)
 
void SetUInt32Value (uint16 index, uint32 value)
 
void UpdateUInt32Value (uint16 index, uint32 value)
 
void SetUInt64Value (uint16 index, uint64 value)
 
void SetFloatValue (uint16 index, float value)
 
void SetByteValue (uint16 index, uint8 offset, uint8 value)
 
void SetUInt16Value (uint16 index, uint8 offset, uint16 value)
 
void SetInt16Value (uint16 index, uint8 offset, int16 value)
 
void SetGuidValue (uint16 index, ObjectGuid value)
 
void SetStatFloatValue (uint16 index, float value)
 
void SetStatInt32Value (uint16 index, int32 value)
 
bool AddGuidValue (uint16 index, ObjectGuid value)
 
bool RemoveGuidValue (uint16 index, ObjectGuid value)
 
void ApplyModUInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModUInt64Value (uint16 index, int32 val, bool apply)
 
void ApplyModPositiveFloatValue (uint16 index, float val, bool apply)
 
void ApplyModSignedFloatValue (uint16 index, float val, bool apply)
 
void ApplyPercentModFloatValue (uint16 index, float val, bool apply)
 
void SetFlag (uint16 index, uint32 newFlag)
 
void RemoveFlag (uint16 index, uint32 oldFlag)
 
void ToggleFlag (uint16 index, uint32 flag)
 
bool HasFlag (uint16 index, uint32 flag) const
 
void ApplyModFlag (uint16 index, uint32 flag, bool apply)
 
void SetByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void RemoveByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
bool HasByteFlag (uint16 index, uint8 offset, uint8 flag) const
 
void SetFlag64 (uint16 index, uint64 newFlag)
 
void RemoveFlag64 (uint16 index, uint64 oldFlag)
 
void ToggleFlag64 (uint16 index, uint64 flag)
 
bool HasFlag64 (uint16 index, uint64 flag) const
 
void ApplyModFlag64 (uint16 index, uint64 flag, bool apply)
 
void ClearUpdateMask (bool remove)
 
uint16 GetValuesCount () const
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
virtual void BuildUpdate (UpdateDataMapType &, UpdatePlayerSet &)
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
bool IsPlayer () const
 
PlayerToPlayer ()
 
Player const * ToPlayer () const
 
CreatureToCreature ()
 
Creature const * ToCreature () const
 
UnitToUnit ()
 
Unit const * ToUnit () const
 
GameObjectToGameObject ()
 
GameObject const * ToGameObject () const
 
CorpseToCorpse ()
 
Corpse const * ToCorpse () const
 
DynamicObjectToDynObject ()
 
DynamicObject const * ToDynObject () const
 
virtual std::string GetDebugInfo () const
 
- Public Member Functions inherited from WorldLocation
 WorldLocation (uint32 _mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
 WorldLocation (uint32 mapId, Position const &position)
 
void WorldRelocate (const WorldLocation &loc)
 
void WorldRelocate (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
void SetMapId (uint32 mapId)
 
uint32 GetMapId () const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z, float &o) const
 
void GetWorldLocation (WorldLocation *location) const
 
WorldLocation GetWorldLocation () const
 
std::string GetDebugInfo () const
 
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 
 Position (Position const &loc)
 
 Position (Position &&)=default
 
Positionoperator= (const Position &)=default
 
Positionoperator= (Position &&)=default
 
bool operator== (Position const &a) const
 
bool operator!= (Position const &a)
 
 operator G3D::Vector3 () const
 
void Relocate (float x, float y)
 
void Relocate (float x, float y, float z)
 
void Relocate (float x, float y, float z, float orientation)
 
void Relocate (const Position &pos)
 
void Relocate (const Position *pos)
 
void RelocatePolarOffset (float angle, float dist, float z=0.0f)
 
void RelocateOffset (const Position &offset)
 
void SetOrientation (float orientation)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
float GetOrientation () const
 
void GetPosition (float &x, float &y) const
 
void GetPosition (float &x, float &y, float &z) const
 
void GetPosition (float &x, float &y, float &z, float &o) const
 
Position GetPosition () const
 
Position::PositionXYZStreamer PositionXYZStream ()
 
Position::PositionXYZOStreamer PositionXYZOStream ()
 
bool IsPositionValid () const
 
float GetExactDist2dSq (const float x, const float y) const
 
float GetExactDist2dSq (Position const &pos) const
 
float GetExactDist2dSq (Position const *pos) const
 
float GetExactDist2d (const float x, const float y) const
 
float GetExactDist2d (Position const &pos) const
 
float GetExactDist2d (Position const *pos) const
 
float GetExactDistSq (float x, float y, float z) const
 
float GetExactDistSq (Position const &pos) const
 
float GetExactDistSq (Position const *pos) const
 
float GetExactDist (float x, float y, float z) const
 
float GetExactDist (Position const &pos) const
 
float GetExactDist (Position const *pos) const
 
void GetPositionOffsetTo (const Position &endPos, Position &retOffset) const
 
Position GetPositionWithOffset (Position const &offset) const
 
float GetAngle (const Position *pos) const
 
float GetAngle (float x, float y) const
 
float GetAbsoluteAngle (float x, float y) const
 
float GetAbsoluteAngle (Position const &pos) const
 
float GetAbsoluteAngle (Position const *pos) const
 
float GetRelativeAngle (const Position *pos) const
 
float GetRelativeAngle (float x, float y) const
 
float ToAbsoluteAngle (float relAngle) const
 
void GetSinCos (float x, float y, float &vsin, float &vcos) const
 
bool IsInDist2d (float x, float y, float dist) const
 
bool IsInDist2d (const Position *pos, float dist) const
 
bool IsInDist (float x, float y, float z, float dist) const
 
bool IsInDist (const Position *pos, float dist) const
 
bool IsWithinBox (const Position &center, float xradius, float yradius, float zradius) const
 
bool HasInArc (float arcangle, const Position *pos, float targetRadius=0.0f) const
 
bool HasInLine (Position const *pos, float width) const
 
std::string ToString () const
 

Static Public Member Functions

static float GetEffectiveResistChance (Unit const *owner, SpellSchoolMask schoolMask, Unit const *victim)
 
static void DealDamageMods (Unit const *victim, uint32 &damage, uint32 *absorb)
 
static uint32 DealDamage (Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true, bool allowGM=false, Spell const *spell=nullptr)
 
static void Kill (Unit *killer, Unit *victim, bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
 
static int32 DealHeal (Unit *healer, Unit *victim, uint32 addhealth)
 
static void ProcDamageAndSpell (Unit *actor, Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellInfo const *procSpellInfo=nullptr, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
 
static void ApplyResilience (Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
 
static uint32 SpellCriticalDamageBonus (Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
 
static uint32 SpellCriticalHealingBonus (Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
 
static bool IsDamageReducedByArmor (SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr, uint8 effIndex=MAX_SPELL_EFFECTS)
 
static uint32 CalcArmorReducedDamage (Unit const *attacker, Unit const *victim, const uint32 damage, SpellInfo const *spellInfo, uint8 attackerLevel=0, WeaponAttackType attackType=MAX_ATTACK)
 
static void CalcAbsorbResist (DamageInfo &dmgInfo, bool Splited=false)
 
static void CalcHealAbsorb (HealInfo &healInfo)
 
static void HandleSafeUnitPointersOnDelete (Unit *thisUnit)
 
- Static Public Member Functions inherited from Object
static ObjectGuid GetGUID (Object const *o)
 
- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
 

Public Attributes

uint32 m_extraAttacks
 
bool m_canDualWield
 
ControlSet m_Controlled
 
SafeUnitPointer m_movedByPlayer
 
ObjectGuid m_SummonSlot [MAX_SUMMON_SLOT]
 
ObjectGuid m_ObjectSlot [MAX_GAMEOBJECT_SLOT]
 
float m_modMeleeHitChance
 
float m_modRangedHitChance
 
float m_modSpellHitChance
 
int32 m_baseSpellCritChance
 
float m_threatModifier [MAX_SPELL_SCHOOL]
 
float m_modAttackSpeedPct [3]
 
EventProcessor m_Events
 
SpellImmuneList m_spellImmune [MAX_SPELL_IMMUNITY]
 
uint32 m_lastSanctuaryTime
 
PetAuraSet m_petAuras
 
bool IsAIEnabled
 
bool NeedChangeAI
 
bool m_ControlledByPlayer
 
bool m_CreatedByPlayer
 
std::set< SafeUnitPointer * > SafeUnitPointerSet
 
Position m_last_notify_position
 
uint32 m_last_notify_mstime
 
uint16 m_delayed_unit_relocation_timer
 
uint16 m_delayed_unit_ai_notify_timer
 
bool bRequestForcedVisibilityUpdate
 
Movement::MoveSplinemovespline
 
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealth
 
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealthDetect
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibility
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibilityDetect
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibility
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibilityDetect
 
uint32 LastUsedScriptID
 
MovementInfo m_movementInfo
 
ElunaEventProcessor * elunaEvents
 
- Public Attributes inherited from Object
DataMap CustomData
 
- Public Attributes inherited from WorldLocation
uint32 m_mapId
 
- Public Attributes inherited from Position
float m_positionX = 0
 
float m_positionY = 0
 
float m_positionZ = 0
 
float m_orientation = 0
 

Protected Types

typedef std::list< DynamicObject * > DynObjectList
 
typedef GuidList GameObjectList
 
typedef std::map< ObjectGuid, float > CharmThreatMap
 

Protected Member Functions

 Unit (bool isWorldObject)
 
void BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const override
 
void _UpdateSpells (uint32 time)
 
void _DeleteRemovedAuras ()
 
void _UpdateAutoRepeatSpell ()
 
bool IsAlwaysVisibleFor (WorldObject const *seer) const override
 
bool IsAlwaysDetectableFor (WorldObject const *seer) const override
 
void SetFeared (bool apply, Unit *fearedBy=nullptr, bool isFear=false)
 
void SetConfused (bool apply)
 
void SetStunned (bool apply)
 
void SetRooted (bool apply, bool isStun=false)
 
- Protected Member Functions inherited from WorldObject
 WorldObject (bool isWorldObject)
 
virtual void ProcessPositionDataChanged (PositionFullTerrainStatus const &data)
 
void SetLocationMapId (uint32 _mapId)
 
void SetLocationInstanceId (uint32 _instanceId)
 
virtual bool IsNeverVisible () const
 
virtual bool IsAlwaysVisibleFor (WorldObject const *) const
 
virtual bool IsInvisibleDueToDespawn () const
 
virtual bool IsAlwaysDetectableFor (WorldObject const *) const
 
- Protected Member Functions inherited from Object
 Object ()
 
void _InitValues ()
 
void _Create (ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
 
std::string _ConcatFields (uint16 startIndex, uint16 size) const
 
bool _LoadIntoDataField (std::string const &data, uint32 startOffset, uint32 count)
 
uint32 GetUpdateFieldData (Player const *target, uint32 *&flags) const
 
void BuildMovementUpdate (ByteBuffer *data, uint16 flags) const
 
virtual void BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const
 
virtual void AddToObjectUpdate ()=0
 
virtual void RemoveFromObjectUpdate ()=0
 
void AddToObjectUpdateIfNeeded ()
 

Protected Attributes

UnitAIi_AI
 
UnitAIi_disabledAI
 
uint8 m_realRace
 
uint8 m_race
 
bool m_AutoRepeatFirstCast
 
int32 m_attackTimer [MAX_ATTACK]
 
float m_createStats [MAX_STATS]
 
AttackerSet m_attackers
 
Unitm_attacking
 
DeathState m_deathState
 
int32 m_procDeep
 
DynObjectList m_dynObj
 
GameObjectList m_gameObj
 
uint32 m_transform
 
Spellm_currentSpells [CURRENT_MAX_SPELL]
 
AuraMap m_ownedAuras
 
AuraApplicationMap m_appliedAuras
 
AuraList m_removedAuras
 
AuraMap::iterator m_auraUpdateIterator
 
uint32 m_removedAurasCount
 
AuraEffectList m_modAuras [TOTAL_AURAS]
 
AuraList m_scAuras
 
AuraApplicationList m_interruptableAuras
 
AuraStateAurasMap m_auraStateAuras
 
uint32 m_interruptMask
 
float m_auraModifiersGroup [UNIT_MOD_END][MODIFIER_TYPE_END]
 
float m_weaponDamage [MAX_ATTACK][MAX_WEAPON_DAMAGE_RANGE][MAX_ITEM_PROTO_DAMAGES]
 
bool m_canModifyStats
 
VisibleAuraMap m_visibleAuras
 
float m_speed_rate [MAX_MOVE_TYPE]
 
CharmInfom_charmInfo
 
SharedVisionList m_sharedVision
 
MotionMasteri_motionMaster
 
uint32 m_reactiveTimer [MAX_REACTIVE]
 
int32 m_regenTimer
 
ThreatMgr m_ThreatMgr
 
CharmThreatMap _charmThreatInfo
 
Vehiclem_vehicle
 
Vehiclem_vehicleKit
 
uint32 m_unitTypeMask
 
LiquidTypeEntry const * _lastLiquid
 
bool m_applyResilience
 
bool _instantCast
 
uint32 m_rootTimes
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
bool m_isFarVisible
 
Optional< float > m_visibilityDistanceOverride
 
const bool m_isWorldObject
 
ZoneScriptm_zoneScript
 
uint32 _zoneId
 
uint32 _areaId
 
float _floorZ
 
bool _outdoors
 
LiquidData _liquidData
 
bool _updatePositionData
 
Transportm_transport
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
uint16 m_updateFlag
 
union {
   int32 *   m_int32Values
 
   uint32 *   m_uint32Values
 
   float *   m_floatValues
 
}; 
 
UpdateMask _changesMask
 
uint16 m_valuesCount
 
uint16 _fieldNotifyFlags
 
bool m_objectUpdated
 

Private Member Functions

bool IsTriggeredAtSpellProcEvent (Unit *victim, Aura *aura, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *&spellProcEvent, ProcEventInfo const &eventInfo)
 
bool HandleDummyAuraProc (Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, Spell const *spellProc=nullptr)
 
bool HandleAuraProc (Unit *victim, uint32 damage, Aura *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, bool *handled)
 
bool HandleProcTriggerSpell (Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, uint32 procPhase, ProcEventInfo &eventInfo)
 
bool HandleOverrideClassScriptAuraProc (Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 cooldown)
 
bool HandleAuraRaidProcFromChargeWithValue (AuraEffect *triggeredByAura)
 
bool HandleAuraRaidProcFromCharge (AuraEffect *triggeredByAura)
 
void UpdateSplineMovement (uint32 t_diff)
 
void UpdateSplinePosition ()
 
float GetCombatRatingReduction (CombatRating cr) const
 
uint32 GetCombatRatingDamageReduction (CombatRating cr, float rate, float cap, uint32 damage) const
 
float processDummyAuras (float TakenTotalMod) const
 

Private Attributes

uint32 m_state
 
uint32 m_CombatTimer
 
uint32 m_lastManaUse
 
Diminishing m_Diminishing
 
HostileRefMgr m_HostileRefMgr
 
FollowerRefMgr m_FollowingRefMgr
 
Unitm_comboTarget
 
int8 m_comboPoints
 
std::unordered_set< Unit * > m_ComboPointHolders
 
RedirectThreatInfo _redirectThreatInfo
 
bool m_cleanupDone
 
bool m_duringRemoveFromWorld
 
uint32 _oldFactionId
 faction before charm More...
 
bool _isWalkingBeforeCharm
 Are we walking before we were charmed? More...
 
uint32 _lastExtraAttackSpell
 
std::unordered_map< ObjectGuid, uint32extraAttacksTargets
 
ObjectGuid _lastDamagedTargetGuid
 

Detailed Description

Member Typedef Documentation

◆ AttackerSet

typedef std::unordered_set<Unit*> Unit::AttackerSet

◆ AuraApplicationList

◆ AuraApplicationMap

◆ AuraApplicationMapBounds

typedef std::pair<AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator> Unit::AuraApplicationMapBounds

◆ AuraApplicationMapBoundsNonConst

typedef std::pair<AuraApplicationMap::iterator, AuraApplicationMap::iterator> Unit::AuraApplicationMapBoundsNonConst

◆ AuraEffectList

typedef std::list<AuraEffect*> Unit::AuraEffectList

◆ AuraList

typedef std::list<Aura*> Unit::AuraList

◆ AuraMap

typedef std::multimap<uint32, Aura*> Unit::AuraMap

◆ AuraMapBounds

typedef std::pair<AuraMap::const_iterator, AuraMap::const_iterator> Unit::AuraMapBounds

◆ AuraMapBoundsNonConst

typedef std::pair<AuraMap::iterator, AuraMap::iterator> Unit::AuraMapBoundsNonConst

◆ AuraStateAurasMap

◆ AuraStateAurasMapBounds

typedef std::pair<AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator> Unit::AuraStateAurasMapBounds

◆ CharmThreatMap

typedef std::map<ObjectGuid, float> Unit::CharmThreatMap
protected

◆ ComboPointHolderSet

◆ ControlSet

typedef std::set<Unit*> Unit::ControlSet

◆ Diminishing

◆ DynObjectList

typedef std::list<DynamicObject*> Unit::DynObjectList
protected

◆ GameObjectList

typedef GuidList Unit::GameObjectList
protected

◆ PetAuraSet

typedef std::set<PetAura const*> Unit::PetAuraSet

◆ VisibleAuraMap

Constructor & Destructor Documentation

◆ ~Unit()

Unit::~Unit ( )
override
360{
361 // set current spells as deletable
362 for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
363 if (m_currentSpells[i])
364 {
366 m_currentSpells[i] = nullptr;
367 }
368
370
371 delete i_motionMaster;
372 delete m_charmInfo;
373 delete movespline;
374
377 ASSERT(m_attackers.empty());
378
379 // pussywizard: clear m_sharedVision along with back references
380 if (!m_sharedVision.empty())
381 {
382 do
383 {
384 Player* p = *(m_sharedVision.begin());
385 p->m_isInSharedVisionOf.erase(this);
386 m_sharedVision.remove(p);
387 } while (!m_sharedVision.empty());
388 }
389
390 ASSERT(m_Controlled.empty());
391 ASSERT(m_appliedAuras.empty());
392 ASSERT(m_ownedAuras.empty());
393 ASSERT(m_removedAuras.empty());
394 ASSERT(m_gameObj.empty());
395 ASSERT(m_dynObj.empty());
396
397 if (m_movedByPlayer && m_movedByPlayer != this)
398 LOG_INFO("misc", "Unit::~Unit (A1)");
399
401}
#define ASSERT
Definition: Errors.h:68
std::uint8_t uint8
Definition: Define.h:110
#define LOG_INFO(filterType__,...)
Definition: Log.h:167
#define CURRENT_MAX_SPELL
Definition: Unit.h:985
Definition: Player.h:1046
std::set< Unit * > m_isInSharedVisionOf
Definition: Player.h:2284
bool m_duringRemoveFromWorld
Definition: Unit.h:2587
Spell * m_currentSpells[CURRENT_MAX_SPELL]
Definition: Unit.h:2499
AuraList m_removedAuras
Definition: Unit.h:2503
ControlSet m_Controlled
Definition: Unit.h:1867
Movement::MoveSpline * movespline
Definition: Unit.h:2440
CharmInfo * m_charmInfo
Definition: Unit.h:2520
MotionMaster * i_motionMaster
Definition: Unit.h:2523
void _DeleteRemovedAuras()
Definition: Unit.cpp:3788
DynObjectList m_dynObj
Definition: Unit.h:2493
SafeUnitPointer m_movedByPlayer
Definition: Unit.h:1888
AttackerSet m_attackers
Definition: Unit.h:2485
Unit * m_attacking
Definition: Unit.h:2486
GameObjectList m_gameObj
Definition: Unit.h:2496
AuraMap m_ownedAuras
Definition: Unit.h:2501
AuraApplicationMap m_appliedAuras
Definition: Unit.h:2502
static void HandleSafeUnitPointersOnDelete(Unit *thisUnit)
Definition: Unit.cpp:4269
SharedVisionList m_sharedVision
Definition: Unit.h:2521
void SetReferencedFromCurrent(bool yes)
Definition: Spell.h:558

References _DeleteRemovedAuras(), ASSERT, CURRENT_MAX_SPELL, HandleSafeUnitPointersOnDelete(), i_motionMaster, LOG_INFO, m_appliedAuras, m_attackers, m_attacking, m_charmInfo, m_Controlled, m_currentSpells, m_duringRemoveFromWorld, m_dynObj, m_gameObj, Player::m_isInSharedVisionOf, m_movedByPlayer, m_ownedAuras, m_removedAuras, m_sharedVision, movespline, and Spell::SetReferencedFromCurrent().

◆ Unit()

Unit::Unit ( bool  isWorldObject)
explicitprotected
206 : WorldObject(isWorldObject),
207 m_movedByPlayer(nullptr),
209 IsAIEnabled(false),
210 NeedChangeAI(false),
212 m_CreatedByPlayer(false),
214 i_AI(nullptr),
215 i_disabledAI(nullptr),
216 m_realRace(0),
217 m_race(0),
219 m_procDeep(0),
221 i_motionMaster(new MotionMaster(this)),
222 m_regenTimer(0),
223 m_ThreatMgr(this),
224 m_vehicle(nullptr),
225 m_vehicleKit(nullptr),
227 m_HostileRefMgr(this),
228 m_comboTarget(nullptr),
230{
231#ifdef _MSC_VER
232#pragma warning(default:4355)
233#endif
236
238
245
246 m_canDualWield = false;
247
248 m_rootTimes = 0;
249
250 m_state = 0;
252
253 for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
254 m_currentSpells[i] = nullptr;
255
256 for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
257 m_SummonSlot[i].Clear();
258
259 for (uint8 i = 0; i < MAX_GAMEOBJECT_SLOT; ++i)
260 m_ObjectSlot[i].Clear();
261
263
264 m_interruptMask = 0;
265 m_transform = 0;
266 m_canModifyStats = false;
267
268 for (uint8 i = 0; i < MAX_SPELL_IMMUNITY; ++i)
269 m_spellImmune[i].clear();
270
271 for (uint8 i = 0; i < UNIT_MOD_END; ++i)
272 {
277 }
278 // implement 50% base damage from offhand
280
281 for (uint8 i = 0; i < MAX_ATTACK; ++i)
282 {
285
286 m_weaponDamage[i][MINDAMAGE][1] = 0.f;
287 m_weaponDamage[i][MAXDAMAGE][1] = 0.f;
288 }
289
290 for (uint8 i = 0; i < MAX_STATS; ++i)
291 m_createStats[i] = 0.0f;
292
293 m_attacking = nullptr;
294 m_modMeleeHitChance = 0.0f;
296 m_modSpellHitChance = 0.0f;
298
299 m_CombatTimer = 0;
300 m_lastManaUse = 0;
301
302 for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
303 m_threatModifier[i] = 1.0f;
304
305 for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
306 m_speed_rate[i] = 1.0f;
307
308 m_charmInfo = nullptr;
309
311
312 // remove aurastates allowing special moves
313 for (uint8 i = 0; i < MAX_REACTIVE; ++i)
314 m_reactiveTimer[i] = 0;
315
316 m_cleanupDone = false;
318
320
321 m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
326
327 m_applyResilience = false;
328 _instantCast = false;
329
330 _lastLiquid = nullptr;
331
332 _oldFactionId = 0;
333
334 _isWalkingBeforeCharm = false;
335
337}
@ TYPEID_UNIT
Definition: ObjectGuid.h:37
@ TYPEMASK_UNIT
Definition: ObjectGuid.h:51
@ UPDATEFLAG_LIVING
Definition: UpdateData.h:44
@ UPDATEFLAG_STATIONARY_POSITION
Definition: UpdateData.h:45
@ UNIT_MASK_NONE
Definition: Unit.h:674
@ OFF_ATTACK
Definition: Unit.h:397
@ MAX_ATTACK
Definition: Unit.h:399
@ BASE_ATTACK
Definition: Unit.h:396
@ RANGED_ATTACK
Definition: Unit.h:398
@ MINDAMAGE
Definition: Unit.h:254
@ MAXDAMAGE
Definition: Unit.h:255
@ UNIT_MOD_DAMAGE_OFFHAND
Definition: Unit.h:285
@ UNIT_MOD_END
Definition: Unit.h:287
@ ALIVE
Definition: Unit.h:316
#define MAX_MOVE_TYPE
Definition: Unit.h:389
#define MAX_SUMMON_SLOT
Definition: Unit.h:1215
@ BASE_VALUE
Definition: Unit.h:245
@ TOTAL_VALUE
Definition: Unit.h:247
@ TOTAL_PCT
Definition: Unit.h:248
@ BASE_PCT
Definition: Unit.h:246
#define BASE_MAXDAMAGE
Definition: Unit.h:39
@ MAX_REACTIVE
Definition: Unit.h:1207
#define MAX_GAMEOBJECT_SLOT
Definition: Unit.h:1217
#define BASE_MINDAMAGE
Definition: Unit.h:38
@ SERVERSIDE_VISIBILITY_GHOST
Definition: SharedDefines.h:1246
#define MAX_STATS
Definition: SharedDefines.h:237
constexpr auto MAX_SPELL_SCHOOL
Definition: SharedDefines.h:264
@ GHOST_VISIBILITY_ALIVE
Definition: SharedDefines.h:1253
#define MAX_SPELL_IMMUNITY
Definition: SharedDefines.h:1376
uint16 m_objectType
Definition: Object.h:228
uint16 m_updateFlag
Definition: Object.h:231
TypeID m_objectTypeId
Definition: Object.h:230
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:360
Definition: Object.h:393
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition: Object.h:509
void Relocate(float x, float y)
Definition: Position.h:73
Definition: Unit.h:948
uint32 m_reactiveTimer[MAX_REACTIVE]
Definition: Unit.h:2525
uint32 m_lastSanctuaryTime
Definition: Unit.h:2137
LiquidTypeEntry const * _lastLiquid
Definition: Unit.h:2536
uint32 m_transform
Definition: Unit.h:2497
uint32 m_CombatTimer
Definition: Unit.h:2570
bool m_canModifyStats
Definition: Unit.h:2515
bool NeedChangeAI
Definition: Unit.h:2350
uint32 m_state
Definition: Unit.h:2569
float m_auraModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_END]
Definition: Unit.h:2513
int32 m_attackTimer[MAX_ATTACK]
Definition: Unit.h:2481
float m_modAttackSpeedPct[3]
Definition: Unit.h:2091
uint8 m_realRace
Definition: Unit.h:2476
Vehicle * m_vehicle
Definition: Unit.h:2532
uint32 m_rootTimes
Definition: Unit.h:2566
uint8 m_race
Definition: Unit.h:2477
UnitAI * i_AI
Definition: Unit.h:2469
uint32 _lastExtraAttackSpell
Definition: Unit.h:2594
bool _instantCast
Definition: Unit.h:2542
ObjectGuid m_ObjectSlot[MAX_GAMEOBJECT_SLOT]
Definition: Unit.h:2069
RedirectThreatInfo _redirectThreatInfo
Definition: Unit.h:2584
float m_createStats[MAX_STATS]
Definition: Unit.h:2483
float m_modRangedHitChance
Definition: Unit.h:2086
DeathState m_deathState
Definition: Unit.h:2488
uint32 m_unitTypeMask
Definition: Unit.h:2535
uint32 m_removedAurasCount
Definition: Unit.h:2505
ThreatMgr m_ThreatMgr
Definition: Unit.h:2528
Unit * m_comboTarget
Definition: Unit.h:2580
AuraMap::iterator m_auraUpdateIterator
Definition: Unit.h:2504
bool m_AutoRepeatFirstCast
Definition: Unit.h:2479
uint16 m_delayed_unit_ai_notify_timer
Definition: Unit.h:2412
int32 m_regenTimer
Definition: Unit.h:2526
bool bRequestForcedVisibilityUpdate
Definition: Unit.h:2413
bool m_ControlledByPlayer
Definition: Unit.h:2362
uint32 m_last_notify_mstime
Definition: Unit.h:2410
SpellImmuneList m_spellImmune[MAX_SPELL_IMMUNITY]
Definition: Unit.h:2136
int8 m_comboPoints
Definition: Unit.h:2581
uint32 _oldFactionId
faction before charm
Definition: Unit.h:2589
int32 m_baseSpellCritChance
Definition: Unit.h:2088
float m_modMeleeHitChance
Definition: Unit.h:2085
float m_weaponDamage[MAX_ATTACK][MAX_WEAPON_DAMAGE_RANGE][MAX_ITEM_PROTO_DAMAGES]
Definition: Unit.h:2514
Position m_last_notify_position
Definition: Unit.h:2409
Vehicle * m_vehicleKit
Definition: Unit.h:2533
bool IsAIEnabled
Definition: Unit.h:2350
HostileRefMgr m_HostileRefMgr
Definition: Unit.h:2576
bool m_applyResilience
Definition: Unit.h:2539
bool m_canDualWield
Definition: Unit.h:1356
uint32 m_interruptMask
Definition: Unit.h:2511
int32 m_procDeep
Definition: Unit.h:2490
float m_speed_rate[MAX_MOVE_TYPE]
Definition: Unit.h:2518
float m_modSpellHitChance
Definition: Unit.h:2087
UnitAI * i_disabledAI
Definition: Unit.h:2469
ObjectGuid m_SummonSlot[MAX_SUMMON_SLOT]
Definition: Unit.h:2068
bool m_cleanupDone
Definition: Unit.h:2586
bool _isWalkingBeforeCharm
Are we walking before we were charmed?
Definition: Unit.h:2590
bool m_CreatedByPlayer
Definition: Unit.h:2363
uint16 m_delayed_unit_relocation_timer
Definition: Unit.h:2411
float m_threatModifier[MAX_SPELL_SCHOOL]
Definition: Unit.h:2090
uint32 m_lastManaUse
Definition: Unit.h:2571
Definition: MotionMaster.h:110
Definition: MoveSpline.h:40

References _instantCast, _isWalkingBeforeCharm, _lastExtraAttackSpell, _lastLiquid, _oldFactionId, _redirectThreatInfo, ALIVE, BASE_ATTACK, BASE_MAXDAMAGE, BASE_MINDAMAGE, BASE_PCT, BASE_VALUE, bRequestForcedVisibilityUpdate, CURRENT_MAX_SPELL, GHOST_VISIBILITY_ALIVE, m_applyResilience, m_attacking, m_attackTimer, m_auraModifiersGroup, m_auraUpdateIterator, m_baseSpellCritChance, m_canDualWield, m_canModifyStats, m_charmInfo, m_cleanupDone, m_CombatTimer, m_createStats, m_currentSpells, m_deathState, m_delayed_unit_ai_notify_timer, m_delayed_unit_relocation_timer, m_duringRemoveFromWorld, m_interruptMask, m_last_notify_mstime, m_last_notify_position, m_lastManaUse, m_modAttackSpeedPct, m_modMeleeHitChance, m_modRangedHitChance, m_modSpellHitChance, m_ObjectSlot, Object::m_objectType, Object::m_objectTypeId, m_ownedAuras, m_reactiveTimer, m_rootTimes, WorldObject::m_serverSideVisibility, m_speed_rate, m_spellImmune, m_state, m_SummonSlot, m_threatModifier, m_transform, Object::m_updateFlag, m_weaponDamage, MAX_ATTACK, MAX_GAMEOBJECT_SLOT, MAX_MOVE_TYPE, MAX_REACTIVE, MAX_SPELL_IMMUNITY, MAX_SPELL_SCHOOL, MAX_STATS, MAX_SUMMON_SLOT, MAXDAMAGE, MINDAMAGE, OFF_ATTACK, RANGED_ATTACK, Position::Relocate(), SERVERSIDE_VISIBILITY_GHOST, FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), TOTAL_PCT, TOTAL_VALUE, TYPEID_UNIT, TYPEMASK_UNIT, UNIT_MOD_DAMAGE_OFFHAND, UNIT_MOD_END, UPDATEFLAG_LIVING, and UPDATEFLAG_STATIONARY_POSITION.

Member Function Documentation

◆ _addAttacker()

void Unit::_addAttacker ( Unit pAttacker)
inline
1359 {
1360 m_attackers.insert(pAttacker);
1361 }

References m_attackers.

Referenced by Attack().

◆ _AddAura()

void Unit::_AddAura ( UnitAura aura,
Unit caster 
)
4355{
4357 m_ownedAuras.insert(AuraMap::value_type(aura->GetId(), aura));
4358
4360
4361 if (aura->IsRemoved())
4362 return;
4363
4365 if (aura->IsSingleTarget())
4366 {
4367 ASSERT((IsInWorld() && !IsDuringRemoveFromWorld()) || (aura->GetCasterGUID() == GetGUID()));
4368 /* @HACK: Player is not in world during loading auras.
4369 * Single target auras are not saved or loaded from database
4370 * but may be created as a result of aura links (player mounts with passengers)
4371 */
4372
4373 // register single target aura
4374 caster->GetSingleCastAuras().push_back(aura);
4375 // remove other single target auras
4376 Unit::AuraList& scAuras = caster->GetSingleCastAuras();
4377 for (Unit::AuraList::iterator itr = scAuras.begin(); itr != scAuras.end();)
4378 {
4379 if ((*itr) != aura &&
4380 (*itr)->IsSingleTargetWith(aura))
4381 {
4382 (*itr)->Remove();
4383 itr = scAuras.begin();
4384 }
4385 else
4386 ++itr;
4387 }
4388 }
4389}
@ SPELL_AURA_CONTROL_VEHICLE
Definition: SpellAuraDefines.h:299
bool IsInWorld() const
Definition: Object.h:101
ObjectGuid GetGUID() const
Definition: Object.h:107
void _RemoveNoStackAurasDueToAura(Aura *aura)
Definition: Unit.cpp:4599
std::list< Aura * > AuraList
Definition: Unit.h:1307
bool IsDuringRemoveFromWorld() const
Definition: Unit.h:2396
AuraList & GetSingleCastAuras()
Definition: Unit.h:1968
ObjectGuid GetCasterGUID() const
Definition: SpellAuras.h:105
bool IsRemoved() const
Definition: SpellAuras.h:161
uint32 GetId() const
Definition: SpellAuras.cpp:466
bool HasEffectType(AuraType type) const
Definition: SpellAuras.cpp:1236
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:100
void SetIsSingleTarget(bool val)
Definition: SpellAuras.h:166
bool IsSingleTarget() const
Definition: SpellAuras.h:164
bool IsSingleTarget() const
Definition: SpellInfo.cpp:1358

References _RemoveNoStackAurasDueToAura(), ASSERT, Aura::GetCasterGUID(), Object::GetGUID(), Aura::GetId(), GetSingleCastAuras(), Aura::GetSpellInfo(), Aura::HasEffectType(), IsDuringRemoveFromWorld(), Object::IsInWorld(), Aura::IsRemoved(), Aura::IsSingleTarget(), SpellInfo::IsSingleTarget(), Aura::IsSingleTargetWith(), m_cleanupDone, m_ownedAuras, Aura::SetIsSingleTarget(), and SPELL_AURA_CONTROL_VEHICLE.

Referenced by UnitAura::UnitAura().

◆ _ApplyAllAuraStatMods()

void Unit::_ApplyAllAuraStatMods ( )
5407{
5408 for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
5409 (*i).second->GetBase()->HandleAllEffects(i->second, AURA_EFFECT_HANDLE_STAT, true);
5410}
@ AURA_EFFECT_HANDLE_STAT
Definition: SpellAuraDefines.h:46

References AURA_EFFECT_HANDLE_STAT, and m_appliedAuras.

Referenced by Player::_ApplyAllStatBonuses().

◆ _ApplyAura()

void Unit::_ApplyAura ( AuraApplication aurApp,
uint8  effMask 
)
4446{
4447 Aura* aura = aurApp->GetBase();
4448
4450
4451 if (aurApp->GetRemoveMode())
4452 return;
4453
4454 Unit* caster = aura->GetCaster();
4455
4456 // Update target aura state flag
4457 SpellInfo const* spellInfo = aura->GetSpellInfo();
4458 if (AuraStateType aState = spellInfo->GetAuraState())
4459 {
4460 if (aState != AURA_STATE_CONFLAGRATE)
4461 {
4462 // Sting (hunter's pet ability), Faerie Fire (druid versions)
4463 if (aState == AURA_STATE_FAERIE_FIRE)
4465
4466 ModifyAuraState(aState, true);
4467 }
4468 else if (caster)
4469 {
4471 m_Events.AddEvent(pEvent, m_Events.CalculateTime(700)); // intended 700ms delay before allowing to cast conflagrate
4472 }
4473 }
4474
4475 if (aurApp->GetRemoveMode())
4476 return;
4477
4478 // Sitdown on apply aura req seated
4481
4482 if (aurApp->GetRemoveMode())
4483 return;
4484
4485 aura->HandleAuraSpecificMods(aurApp, caster, true, false);
4486
4487 // apply effects of the aura
4488 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
4489 {
4490 if (effMask & 1 << i && (!aurApp->GetRemoveMode()))
4491 aurApp->_HandleEffect(i, true);
4492 }
4493
4494 sScriptMgr->OnAuraApply(this, aura);
4495}
@ UNIT_STAND_STATE_SIT
Definition: Unit.h:54
#define sScriptMgr
Definition: ScriptMgr.h:2697
@ SPELL_AURA_MOD_STEALTH
Definition: SpellAuraDefines.h:79
@ AURA_INTERRUPT_FLAG_NOT_SEATED
Definition: SpellDefines.h:62
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1596
AuraStateType
Definition: SharedDefines.h:1260
@ AURA_STATE_FAERIE_FIRE
Definition: SharedDefines.h:1276
@ AURA_STATE_CONFLAGRATE
Definition: SharedDefines.h:1278
void AddEvent(BasicEvent *Event, uint64 e_time, bool set_addtime=true)
Definition: EventProcessor.cpp:114
uint64 CalculateTime(uint64 t_offset) const
Definition: EventProcessor.cpp:136
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
Definition: Unit.h:1290
void ModifyAuraState(AuraStateType flag, bool apply)
Definition: Unit.cpp:10457
EventProcessor m_Events
Definition: Unit.h:2094
void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
Definition: Unit.cpp:5025
void SetStandState(uint8 state)
Definition: Unit.cpp:16874
bool IsSitState() const
Definition: Unit.cpp:16859
Definition: Unit.h:2656
Unit * GetTarget() const
Definition: SpellAuras.h:61
void _HandleEffect(uint8 effIndex, bool apply)
Definition: SpellAuras.cpp:161
Aura * GetBase() const
Definition: SpellAuras.h:62
AuraRemoveMode GetRemoveMode() const
Definition: SpellAuras.h:73
Definition: SpellAuras.h:87
Unit * GetCaster() const
Definition: SpellAuras.cpp:471
void HandleAuraSpecificMods(AuraApplication const *aurApp, Unit *caster, bool apply, bool onReapply)
Definition: SpellAuras.cpp:1279
Definition: SpellInfo.h:314
AuraStateType GetAuraState() const
Definition: SpellInfo.cpp:2045
uint32 AuraInterruptFlags
Definition: SpellInfo.h:351

References AuraApplication::_HandleEffect(), _RemoveNoStackAurasDueToAura(), EventProcessor::AddEvent(), AURA_INTERRUPT_FLAG_NOT_SEATED, AURA_STATE_CONFLAGRATE, AURA_STATE_FAERIE_FIRE, SpellInfo::AuraInterruptFlags, EventProcessor::CalculateTime(), SpellInfo::GetAuraState(), AuraApplication::GetBase(), Aura::GetCaster(), Object::GetGUID(), AuraApplication::GetRemoveMode(), Aura::GetSpellInfo(), AuraApplication::GetTarget(), Aura::HandleAuraSpecificMods(), IsSitState(), m_Events, MAX_SPELL_EFFECTS, ModifyAuraState(), RemoveAurasByType(), SetStandState(), SPELL_AURA_MOD_STEALTH, sScriptMgr, and UNIT_STAND_STATE_SIT.

Referenced by _ApplyAuraEffect().

◆ _ApplyAuraEffect()

void Unit::_ApplyAuraEffect ( Aura aura,
uint8  effIndex 
)
4432{
4433 ASSERT(aura);
4434 ASSERT(aura->HasEffect(effIndex));
4436 ASSERT(aurApp);
4437 if (!aurApp->GetEffectMask())
4438 _ApplyAura(aurApp, 1 << effIndex);
4439 else
4440 aurApp->_HandleEffect(effIndex, true);
4441}
void _ApplyAura(AuraApplication *aurApp, uint8 effMask)
Definition: Unit.cpp:4445
Definition: SpellAuras.h:37
uint8 GetEffectMask() const
Definition: SpellAuras.h:66
bool HasEffect(uint8 effIndex) const
Definition: SpellAuras.h:173
const AuraApplication * GetApplicationOfTarget(ObjectGuid guid) const
Definition: SpellAuras.h:183

References _ApplyAura(), AuraApplication::_HandleEffect(), ASSERT, Aura::GetApplicationOfTarget(), AuraApplication::GetEffectMask(), Object::GetGUID(), and Aura::HasEffect().

◆ _CreateAuraApplication()

AuraApplication * Unit::_CreateAuraApplication ( Aura aura,
uint8  effMask 
)
4394{
4395 // can't apply aura on unit which is going to be deleted - to not create a memory leak
4397 // aura musn't be removed
4398 ASSERT(!aura->IsRemoved());
4399
4400 // aura mustn't be already applied on target
4401 ASSERT (!aura->IsAppliedOnTarget(GetGUID()) && "Unit::_CreateAuraApplication: aura musn't be applied on target");
4402
4403 SpellInfo const* aurSpellInfo = aura->GetSpellInfo();
4404 uint32 aurId = aurSpellInfo->Id;
4405
4406 // ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load)
4407 // Xinef: Added IsAllowingDeadTarget check
4408 if (!IsAlive() && !aurSpellInfo->IsDeathPersistent() && !aurSpellInfo->IsAllowingDeadTarget() && (GetTypeId() != TYPEID_PLAYER || !ToPlayer()->GetSession()->PlayerLoading()))
4409 return nullptr;
4410
4411 Unit* caster = aura->GetCaster();
4412
4413 AuraApplication* aurApp = new AuraApplication(this, caster, aura, effMask);
4414 m_appliedAuras.insert(AuraApplicationMap::value_type(aurId, aurApp));
4415
4416 // xinef: do not insert our application to interruptible list if application target is not the owner (area auras)
4417 // xinef: even if it gets removed, it will be reapplied in a second
4418 if (aurSpellInfo->AuraInterruptFlags && this == aura->GetOwner())
4419 {
4420 m_interruptableAuras.push_back(aurApp);
4421 AddInterruptMask(aurSpellInfo->AuraInterruptFlags);
4422 }
4423
4424 if (AuraStateType aState = aura->GetSpellInfo()->GetAuraState())
4425 m_auraStateAuras.insert(AuraStateAurasMap::value_type(aState, aurApp));
4426
4427 aura->_ApplyForTarget(this, caster, aurApp);
4428 return aurApp;
4429}
std::uint32_t uint32
Definition: Define.h:108
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
Player * ToPlayer()
Definition: Object.h:195
TypeID GetTypeId() const
Definition: Object.h:121
void AddInterruptMask(uint32 mask)
Definition: Unit.h:2163
bool IsAlive() const
Definition: Unit.h:1808
AuraApplicationList m_interruptableAuras
Definition: Unit.h:2509
AuraStateAurasMap m_auraStateAuras
Definition: Unit.h:2510
WorldObject * GetOwner() const
Definition: SpellAuras.h:107
bool IsAppliedOnTarget(ObjectGuid guid) const
Definition: SpellAuras.h:185
virtual void _ApplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
Definition: SpellAuras.cpp:492
bool IsDeathPersistent() const
Definition: SpellInfo.cpp:1201
uint32 Id
Definition: SpellInfo.h:318
bool IsAllowingDeadTarget() const
Definition: SpellInfo.cpp:1211

References Aura::_ApplyForTarget(), AddInterruptMask(), ASSERT, SpellInfo::AuraInterruptFlags, SpellInfo::GetAuraState(), Aura::GetCaster(), Object::GetGUID(), Aura::GetOwner(), Aura::GetSpellInfo(), Object::GetTypeId(), SpellInfo::Id, IsAlive(), SpellInfo::IsAllowingDeadTarget(), Aura::IsAppliedOnTarget(), SpellInfo::IsDeathPersistent(), Aura::IsRemoved(), m_appliedAuras, m_auraStateAuras, m_cleanupDone, m_interruptableAuras, Object::ToPlayer(), and TYPEID_PLAYER.

◆ _DeleteRemovedAuras()

void Unit::_DeleteRemovedAuras ( )
protected
3789{
3790 while (!m_removedAuras.empty())
3791 {
3792 delete m_removedAuras.front();
3793 m_removedAuras.pop_front();
3794 }
3795}

References m_removedAuras.

Referenced by _UpdateSpells(), and ~Unit().

◆ _EnterVehicle()

void Unit::_EnterVehicle ( Vehicle vehicle,
int8  seatId,
AuraApplication const *  aurApp = nullptr 
)
19785{
19786 // Must be called only from aura handler
19787 if (!IsAlive() || GetVehicleKit() == vehicle || vehicle->GetBase()->IsOnVehicle(this))
19788 return;
19789
19790 if (m_vehicle)
19791 {
19792 if (m_vehicle == vehicle)
19793 {
19794 if (seatId >= 0 && seatId != GetTransSeat())
19795 {
19796 LOG_DEBUG("vehicles", "EnterVehicle: {} leave vehicle {} seat {} and enter {}.", GetEntry(), m_vehicle->GetBase()->GetEntry(), GetTransSeat(), seatId);
19797 ChangeSeat(seatId);
19798 }
19799
19800 return;
19801 }
19802 else
19803 {
19804 LOG_DEBUG("vehicles", "EnterVehicle: {} exit {} and enter {}.", GetEntry(), m_vehicle->GetBase()->GetEntry(), vehicle->GetBase()->GetEntry());
19805 ExitVehicle();
19806 }
19807 }
19808
19809 if (!aurApp || aurApp->GetRemoveMode())
19810 return;
19811
19812 if (Player* player = ToPlayer())
19813 {
19814 if (vehicle->GetBase()->GetTypeId() == TYPEID_PLAYER && player->IsInCombat())
19815 return;
19816
19817 sScriptMgr->AnticheatSetUnderACKmount(player);
19818 sScriptMgr->AnticheatSetSkipOnePacketForASH(player, true);
19819
19821 player->StopCastingCharm();
19822 player->StopCastingBindSight();
19823 Dismount();
19825
19826 // drop flag at invisible in bg
19827 if (Battleground* bg = player->GetBattleground())
19828 bg->EventPlayerDroppedFlag(player);
19829
19831 player->GetSession()->SendPacket(&data);
19832 }
19833
19834 ASSERT(!m_vehicle);
19835 m_vehicle = vehicle;
19836
19837 if (!m_vehicle->AddPassenger(this, seatId))
19838 {
19839 m_vehicle = nullptr;
19840 return;
19841 }
19842
19843 // Xinef: remove movement auras when entering vehicle (food buffs etc)
19845}
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:171
@ SPELL_AURA_MOUNTED
Definition: SpellAuraDefines.h:141
@ AURA_INTERRUPT_FLAG_MOVE
Definition: SpellDefines.h:47
@ AURA_INTERRUPT_FLAG_TURNING
Definition: SpellDefines.h:48
@ SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA
Definition: Opcodes.h:1211
Definition: Battleground.h:293
uint32 GetEntry() const
Definition: Object.h:109
int8 GetTransSeat() const
Definition: Object.h:591
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition: Unit.cpp:4069
void Dismount()
Definition: Unit.cpp:13440
bool IsOnVehicle(Unit const *vehicle) const
Definition: Unit.h:2355
void ChangeSeat(int8 seatId, bool next=true)
Definition: Unit.cpp:19847
Vehicle * GetVehicleKit() const
Definition: Unit.h:2353
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0, bool isAutoshot=false)
Definition: Unit.cpp:5096
void ExitVehicle(Position const *exitPosition=nullptr)
Definition: Unit.cpp:19866
Unit * GetBase() const
May be called from scripts.
Definition: Vehicle.h:39
bool AddPassenger(Unit *passenger, int8 seatId=-1)
Definition: Vehicle.cpp:307
Definition: WorldPacket.h:27

References Vehicle::AddPassenger(), ASSERT, AURA_INTERRUPT_FLAG_MOVE, AURA_INTERRUPT_FLAG_TURNING, ChangeSeat(), Dismount(), ExitVehicle(), Vehicle::GetBase(), Object::GetEntry(), AuraApplication::GetRemoveMode(), WorldObject::GetTransSeat(), Object::GetTypeId(), GetVehicleKit(), InterruptNonMeleeSpells(), IsAlive(), IsOnVehicle(), LOG_DEBUG, m_vehicle, RemoveAurasByType(), RemoveAurasWithInterruptFlags(), SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, SPELL_AURA_MOUNTED, sScriptMgr, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by AuraEffect::HandleAuraControlVehicle().

◆ _ExitVehicle()

void Unit::_ExitVehicle ( Position const *  exitPosition = nullptr)
19905{
19906 if (!m_vehicle)
19907 return;
19908
19910
19911 Player* player = ToPlayer();
19912
19913 // If player is on mouted duel and exits the mount should immediatly lose the duel
19914 if (player && player->duel && player->duel->IsMounted)
19915 player->DuelComplete(DUEL_FLED);
19916
19917 // This should be done before dismiss, because there may be some aura removal
19918 Vehicle* vehicle = m_vehicle;
19919 Unit* vehicleBase = m_vehicle->GetBase();
19920 m_vehicle = nullptr;
19921
19922 SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT
19923
19924 Position pos;
19925 if (!exitPosition) // Exit position not specified
19926 pos = vehicleBase->GetPosition(); // This should use passenger's current position, leaving it as it is now
19927 // because we calculate positions incorrect (sometimes under map)
19928 else
19929 pos = *exitPosition;
19930
19931 // HACK
19932 if (vehicle->GetVehicleInfo()->m_ID == 380) // Kologarn right arm
19933 pos.Relocate(1776.0f, -24.0f, 448.75f, 0.0f);
19934 else if (vehicle->GetVehicleInfo()->m_ID == 91) // Helsman's Ship
19935 pos.Relocate(2802.18f, 7054.91f, -0.6f, 4.67f);
19936 else if (vehicle->GetVehicleInfo()->m_ID == 349) // AT Mounts, dismount to the right
19937 {
19938 float x = pos.GetPositionX() + 2.0f * cos(pos.GetOrientation() - M_PI / 2.0f);
19939 float y = pos.GetPositionY() + 2.0f * std::sin(pos.GetOrientation() - M_PI / 2.0f);
19940 float z = GetMapHeight(x, y, pos.GetPositionZ());
19941 if (z > INVALID_HEIGHT)
19942 pos.Relocate(x, y, z);
19943 }
19944
19946
19947 if (player)
19948 {
19950
19951 sScriptMgr->AnticheatSetUnderACKmount(player);
19952 sScriptMgr->AnticheatSetSkipOnePacketForASH(player, true);
19953 }
19955 {
19957 data << GetPackGUID();
19958 SendMessageToSet(&data, false);
19959 }
19960
19961 // xinef: hack for flameleviathan seat vehicle
19962 if (vehicle->GetVehicleInfo()->m_ID != 341)
19963 {
19964 Movement::MoveSplineInit init(this);
19965 init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
19966 init.SetFacing(GetOrientation());
19967 init.SetTransportExit();
19968 init.Launch();
19969 }
19970 else
19971 {
19972 float o = pos.GetAngle(this);
19973 Movement::MoveSplineInit init(this);
19974 init.MoveTo(pos.GetPositionX() + 8 * cos(o), pos.GetPositionY() + 8 * std::sin(o), pos.GetPositionZ() + 16.0f);
19975 init.SetFacing(GetOrientation());
19976 init.SetTransportExit();
19977 init.Launch();
19978 DisableSpline();
19979 KnockbackFrom(pos.GetPositionX(), pos.GetPositionY(), 10.0f, 20.0f);
19981 }
19982
19983 // xinef: move fall, should we support all creatures that exited vehicle in air? Currently Quest Drag and Drop only, Air Assault quest
19984 if (GetTypeId() == TYPEID_UNIT && !CanFly() &&
19985 (vehicle->GetVehicleInfo()->m_ID == 113 || vehicle->GetVehicleInfo()->m_ID == 8 || vehicle->GetVehicleInfo()->m_ID == 290 || vehicle->GetVehicleInfo()->m_ID == 298))
19987 //GetMotionMaster()->MoveFall(); // Enable this once passenger positions are calculater properly (see above)
19988
19989 if ((!player || !(player->GetDelayedOperations() & DELAYED_VEHICLE_TELEPORT)) && vehicle->GetBase()->HasUnitTypeMask(UNIT_MASK_MINION))
19990 if (((Minion*)vehicleBase)->GetOwner() == this)
19991 {
19992 if (vehicle->GetVehicleInfo()->m_ID != 349)
19993 vehicle->Dismiss();
19994 else if (vehicleBase->GetTypeId() == TYPEID_UNIT)
19995 {
19996 vehicle->Uninstall();
19997 vehicleBase->m_Events.AddEvent(new VehicleDespawnEvent(*vehicleBase, 2000), vehicleBase->m_Events.CalculateTime(2000));
19998 }
19999
20000 // xinef: ugly hack, no appripriate hook later to cast spell
20001 if (player)
20002 {
20003 if (vehicleBase->GetEntry() == NPC_EIDOLON_WATCHER)
20004 player->CastSpell(player, VEHICLE_SPELL_SHADE_CONTROL_END, true);
20005 else if (vehicleBase->GetEntry() == NPC_LITHE_STALKER)
20006 player->CastSpell(player, VEHICLE_SPELL_GEIST_CONTROL_END, true);
20007 }
20008 }
20009
20011 {
20012 // Vehicle just died, we die too
20013 if (vehicleBase->getDeathState() == JUST_DIED)
20015 // If for other reason we as minion are exiting the vehicle (ejected, master dismounted) - unsummon
20016 else
20017 {
20018 SetVisible(false);
20019 ToTempSummon()->UnSummon(2000); // Approximation
20020 }
20021 }
20022
20023 if (player)
20025}
@ DELAYED_VEHICLE_TELEPORT
Definition: Player.h:901
@ MOVEMENTFLAG_ROOT
Definition: Unit.h:563
@ UNIT_MASK_ACCESSORY
Definition: Unit.h:684
@ UNIT_MASK_MINION
Definition: Unit.h:676
@ JUST_DIED
Definition: Unit.h:317
@ UNIT_STATE_ROOT
Definition: Unit.h:335
@ UNIT_STATE_MOVE
Definition: Unit.h:344
@ VEHICLE_SPELL_PARACHUTE
Definition: VehicleDefines.h:54
@ VEHICLE_SPELL_SHADE_CONTROL_END
Definition: VehicleDefines.h:57
@ VEHICLE_SPELL_GEIST_CONTROL_END
Definition: VehicleDefines.h:56
@ NPC_EIDOLON_WATCHER
Definition: VehicleDefines.h:62
@ NPC_LITHE_STALKER
Definition: VehicleDefines.h:63
#define INVALID_HEIGHT
Definition: Map.h:164
@ DUEL_FLED
Definition: SharedDefines.h:3586
@ SMSG_SPLINE_MOVE_UNROOT
Definition: Opcodes.h:802
Seconds GetGameTime()
Definition: GameTime.cpp:38
virtual void UnSummon(uint32 msTime=0)
Definition: TemporarySummon.cpp:283
Definition: TemporarySummon.h:76
PackedGuid const & GetPackGUID() const
Definition: Object.h:108
float GetMapHeight(float x, float y, float z, bool vmap=true, float distanceToSearch=50.0f) const
Definition: Object.cpp:3049
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition: Object.h:482
Definition: Position.h:28
float GetPositionZ() const
Definition: Position.h:119
float GetOrientation() const
Definition: Position.h:120
float GetPositionX() const
Definition: Position.h:117
void GetPosition(float &x, float &y) const
Definition: Position.h:122
float GetPositionY() const
Definition: Position.h:118
float GetAngle(const Position *pos) const
Definition: Position.cpp:77
void DuelComplete(DuelCompleteType type)
Definition: Player.cpp:6309
void SetFallInformation(uint32 time, float z)
Definition: Player.h:2285
std::unique_ptr< DuelInfo > duel
Definition: Player.h:1828
void ResummonPetTemporaryUnSummonedIfAny()
Definition: Player.cpp:14111
uint32 GetDelayedOperations() const
Definition: Player.h:2049
void SetVisible(bool x)
Definition: Unit.cpp:14134
virtual void setDeathState(DeathState s, bool despawn=false)
Definition: Unit.cpp:14442
Unit * GetOwner() const
Definition: Unit.cpp:10560
DeathState getDeathState()
Definition: Unit.h:1811
virtual bool CanFly() const =0
MotionMaster * GetMotionMaster()
Definition: Unit.h:2262
TempSummon * ToTempSummon()
Definition: Unit.h:2400
void DisableSpline()
Definition: Unit.cpp:655
void AddUnitState(uint32 f)
Definition: Unit.h:1397
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition: Unit.cpp:18165
bool HasUnitMovementFlag(uint32 f) const
Definition: Unit.h:2274
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1169
uint32 HasUnitTypeMask(uint32 mask) const
Definition: Unit.h:1407
void KnockbackFrom(float x, float y, float speedXY, float speedZ)
Definition: Unit.cpp:19281
Definition: Unit.h:2679
Definition: Vehicle.h:30
void Dismiss()
Definition: Vehicle.cpp:527
VehicleEntry const * GetVehicleInfo() const
Definition: Vehicle.h:40
void RemovePassenger(Unit *passenger)
Definition: Vehicle.cpp:447
void Uninstall()
Definition: Vehicle.cpp:99
void MoveFall(uint32 id=0, bool addFlagForNPC=false)
Definition: MotionMaster.cpp:545
Definition: MoveSplineInit.h:71
uint32 m_ID
Definition: DBCStructure.h:1990

References EventProcessor::AddEvent(), AddUnitState(), EventProcessor::CalculateTime(), CanFly(), CastSpell(), DELAYED_VEHICLE_TELEPORT, DisableSpline(), Vehicle::Dismiss(), Player::duel, DUEL_FLED, Player::DuelComplete(), Position::GetAngle(), Vehicle::GetBase(), getDeathState(), Player::GetDelayedOperations(), Object::GetEntry(), GameTime::GetGameTime(), WorldObject::GetMapHeight(), GetMotionMaster(), Position::GetOrientation(), GetOwner(), Object::GetPackGUID(), Position::GetPosition(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Object::GetTypeId(), Vehicle::GetVehicleInfo(), HasUnitMovementFlag(), HasUnitTypeMask(), INVALID_HEIGHT, JUST_DIED, KnockbackFrom(), Movement::MoveSplineInit::Launch(), m_Events, VehicleEntry::m_ID, m_vehicle, MotionMaster::MoveFall(), MOVEMENTFLAG_ROOT, Movement::MoveSplineInit::MoveTo(), NPC_EIDOLON_WATCHER, NPC_LITHE_STALKER, Position::Relocate(), Vehicle::RemovePassenger(), Player::ResummonPetTemporaryUnSummonedIfAny(), WorldObject::SendMessageToSet(), SetControlled(), setDeathState(), Movement::MoveSplineInit::SetFacing(), Player::SetFallInformation(), Movement::MoveSplineInit::SetTransportExit(), SetVisible(), SMSG_SPLINE_MOVE_UNROOT, sScriptMgr, Object::ToPlayer(), ToTempSummon(), TYPEID_UNIT, Vehicle::Uninstall(), UNIT_MASK_ACCESSORY, UNIT_MASK_MINION, UNIT_STATE_MOVE, UNIT_STATE_ROOT, TempSummon::UnSummon(), VEHICLE_SPELL_GEIST_CONTROL_END, VEHICLE_SPELL_PARACHUTE, and VEHICLE_SPELL_SHADE_CONTROL_END.

Referenced by AuraEffect::HandleAuraControlVehicle(), and boss_mimiron::boss_mimironAI::UpdateAI().

◆ _IsNoStackAuraDueToAura()

bool Unit::_IsNoStackAuraDueToAura ( Aura appliedAura,
Aura existingAura 
) const

◆ _IsValidAssistTarget()

bool Unit::_IsValidAssistTarget ( Unit const *  target,
SpellInfo const *  bySpell 
) const
13908{
13909 ASSERT(target);
13910
13911 // can assist to self
13912 if (this == target)
13913 return true;
13914
13915 // can't assist unattackable units or GMs
13916 if (target->HasUnitState(UNIT_STATE_UNATTACKABLE)
13917 || (target->GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->IsGameMaster()))
13918 return false;
13919
13920 // can't assist own vehicle or passenger
13921 if (m_vehicle)
13922 if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target))
13923 return false;
13924
13925 // can't assist invisible
13926 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT)) && !CanSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()))
13927 return false;
13928
13929 // can't assist dead
13930 if ((!bySpell || !bySpell->IsAllowingDeadTarget()) && !target->IsAlive())
13931 return false;
13932
13933 // can't assist untargetable
13934 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE))
13935 && target->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
13936 return false;
13937
13938 if (!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC))
13939 {
13940 // xinef: do not allow to assist non attackable units
13941 if (target->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
13942 return false;
13943
13945 {
13946 if (target->IsImmuneToPC())
13947 return false;
13948 }
13949 else
13950 {
13951 if (target->IsImmuneToNPC())
13952 return false;
13953 }
13954 }
13955
13956 // can't assist non-friendly targets
13957 if (GetReactionTo(target) < REP_NEUTRAL
13958 && target->GetReactionTo(this) < REP_NEUTRAL
13959 && (!ToCreature() || !(ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT)))
13960 return false;
13961
13962 // PvP case
13963 if (target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
13964 {
13965 Player const* targetPlayerOwner = target->GetAffectingPlayer();
13967 {
13968 Player const* selfPlayerOwner = GetAffectingPlayer();
13969 if (selfPlayerOwner && targetPlayerOwner)
13970 {
13971 // can't assist player which is dueling someone
13972 if (selfPlayerOwner != targetPlayerOwner
13973 && targetPlayerOwner->duel)
13974 return false;
13975 }
13976 // can't assist player in ffa_pvp zone from outside
13977 if (target->IsFFAPvP() && !IsFFAPvP())
13978 return false;
13979
13980 // can't assist player out of sanctuary from sanctuary if has pvp enabled
13981 if (target->IsPvP())
13982 if (IsInSanctuary() && !target->IsInSanctuary())
13983 return false;
13984 }
13985 }
13986 // PvC case - player can assist creature only if has specific type flags
13987 // !target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) &&
13989 && (!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC))
13990 && !target->IsPvP())
13991 {
13992 if (Creature const* creatureTarget = target->ToCreature())
13993 return creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT || creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_CAN_ASSIST;
13994 }
13995 return true;
13996}
@ UNIT_STATE_UNATTACKABLE
Definition: Unit.h:362
@ UNIT_FLAG_NON_ATTACKABLE
Definition: Unit.h:449
@ UNIT_FLAG_NOT_SELECTABLE
Definition: Unit.h:473
@ UNIT_FLAG_PLAYER_CONTROLLED
Definition: Unit.h:451
@ REP_NEUTRAL
Definition: SharedDefines.h:155
@ CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT
Definition: SharedDefines.h:2693
@ CREATURE_TYPE_FLAG_CAN_ASSIST
Definition: SharedDefines.h:2679
@ SPELL_ATTR6_CAN_TARGET_UNTARGETABLE
Definition: SharedDefines.h:600
@ SPELL_ATTR6_IGNORE_PHASE_SHIFT
Definition: SharedDefines.h:589
@ SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC
Definition: SharedDefines.h:579
Definition: Creature.h:46
Creature * ToCreature()
Definition: Object.h:197
bool CanSeeOrDetect(WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
Definition: Object.cpp:1726
ReputationRank GetReactionTo(Unit const *target, bool checkOriginalFaction=false) const
Definition: Unit.cpp:10037
bool HasUnitFlag(UnitFlags flags) const
Definition: Unit.h:1480
bool IsInSanctuary() const
Definition: Unit.h:1516
bool IsFFAPvP() const
Definition: Unit.h:1518
Player * GetAffectingPlayer() const
Definition: Unit.cpp:10585

References ASSERT, WorldObject::CanSeeOrDetect(), CREATURE_TYPE_FLAG_CAN_ASSIST, CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, Player::duel, GetAffectingPlayer(), Vehicle::GetBase(), GetReactionTo(), Object::GetTypeId(), SpellInfo::HasAttribute(), HasUnitFlag(), HasUnitState(), SpellInfo::IsAffectingArea(), IsAlive(), SpellInfo::IsAllowingDeadTarget(), IsFFAPvP(), Player::IsGameMaster(), IsImmuneToNPC(), IsImmuneToPC(), IsInSanctuary(), IsOnVehicle(), IsPvP(), m_vehicle, REP_NEUTRAL, SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC, SPELL_ATTR6_CAN_TARGET_UNTARGETABLE, SPELL_ATTR6_IGNORE_PHASE_SHIFT, Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_NOT_SELECTABLE, UNIT_FLAG_PLAYER_CONTROLLED, and UNIT_STATE_UNATTACKABLE.

Referenced by SpellInfo::CheckExplicitTarget(), IsValidAssistTarget(), and Acore::WorldObjectSpellTargetCheck::operator()().

◆ _IsValidAttackTarget()

bool Unit::_IsValidAttackTarget ( Unit const *  target,
SpellInfo const *  bySpell,
WorldObject const *  obj = nullptr 
) const
13788{
13789 ASSERT(target);
13790
13791 // can't attack self
13792 if (this == target)
13793 return false;
13794
13795 // can't attack unattackable units or GMs
13796 if (target->HasUnitState(UNIT_STATE_UNATTACKABLE)
13797 || (target->GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->IsGameMaster()))
13798 return false;
13799
13800 // can't attack own vehicle or passenger
13801 if (m_vehicle)
13802 if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target))
13803 if (!IsHostileTo(target)) // pussywizard: actually can attack own vehicle or passenger if it's hostile to us - needed for snobold in Gormok encounter
13804 return false;
13805
13806 // can't attack invisible (ignore stealth for aoe spells) also if the area being looked at is from a spell use the dynamic object created instead of the casting unit.
13807 //Ignore stealth if target is player and unit in combat with same player
13808 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT)) && (obj ? !obj->CanSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()) : !CanSeeOrDetect(target, (bySpell && bySpell->IsAffectingArea()) || (target->GetTypeId() == TYPEID_PLAYER && target->HasStealthAura() && target->IsInCombat() && IsInCombatWith(target)))))
13809 return false;
13810
13811 // can't attack dead
13812 if ((!bySpell || !bySpell->IsAllowingDeadTarget()) && !target->IsAlive())
13813 return false;
13814
13815 // can't attack untargetable
13816 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE))
13817 && target->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
13818 return false;
13819
13820 if (Player const* playerAttacker = ToPlayer())
13821 {
13822 if (playerAttacker->HasPlayerFlag(PLAYER_FLAGS_UBER) || playerAttacker->IsSpectator())
13823 return false;
13824 }
13825 // check flags
13827 || (!HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && target->IsImmuneToNPC())
13828 || (!target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && IsImmuneToNPC())
13829 || (HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && target->IsImmuneToPC())
13830 // check if this is a world trigger cast - GOs are using world triggers to cast their spells, so we need to ignore their immunity flag here, this is a temp workaround, needs removal when go cast is implemented properly
13831 || ((GetEntry() != WORLD_TRIGGER && (!obj || !obj->isType(TYPEMASK_GAMEOBJECT | TYPEMASK_DYNAMICOBJECT))) && target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && IsImmuneToPC()))
13832 return false;
13833
13834 // CvC case - can attack each other only when one of them is hostile
13836 return GetReactionTo(target) <= REP_HOSTILE || target->GetReactionTo(this) <= REP_HOSTILE;
13837
13838 // PvP, PvC, CvP case
13839 // can't attack friendly targets
13840 ReputationRank repThisToTarget = GetReactionTo(target);
13841 ReputationRank repTargetToThis;
13842
13843 if (repThisToTarget > REP_NEUTRAL
13844 || (repTargetToThis = target->GetReactionTo(this)) > REP_NEUTRAL)
13845 return false;
13846
13847 // Not all neutral creatures can be attacked (even some unfriendly faction does not react aggresive to you, like Sporaggar)
13848 if (repThisToTarget == REP_NEUTRAL &&
13849 repTargetToThis <= REP_NEUTRAL)
13850 {
13851 Player* owner = GetAffectingPlayer();
13852 Unit const* const thisUnit = owner ? owner : this;
13853 if (!(target->GetTypeId() == TYPEID_PLAYER && thisUnit->GetTypeId() == TYPEID_PLAYER) &&
13854 !(target->GetTypeId() == TYPEID_UNIT && thisUnit->GetTypeId() == TYPEID_UNIT))
13855 {
13856 Player const* player = target->GetTypeId() == TYPEID_PLAYER ? target->ToPlayer() : thisUnit->ToPlayer();
13857 Unit const* creature = target->GetTypeId() == TYPEID_UNIT ? target : thisUnit;
13858
13859 if (FactionTemplateEntry const* factionTemplate = creature->GetFactionTemplateEntry())
13860 {
13861 if (!(player->GetReputationMgr().GetForcedRankIfAny(factionTemplate)))
13862 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplate->faction))
13863 if (FactionState const* repState = player->GetReputationMgr().GetState(factionEntry))
13864 if (!(repState->Flags & FACTION_FLAG_AT_WAR))
13865 return false;
13866 }
13867 }
13868 }
13869
13870 Creature const* creatureAttacker = ToCreature();
13871 if (creatureAttacker && creatureAttacker->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT)
13872 return false;
13873
13874 Player const* playerAffectingAttacker = HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) ? GetAffectingPlayer() : nullptr;
13875 Player const* playerAffectingTarget = target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) ? target->GetAffectingPlayer() : nullptr;
13876
13877 // check duel - before sanctuary checks
13878 if (playerAffectingAttacker && playerAffectingTarget)
13879 if (playerAffectingAttacker->duel && playerAffectingAttacker->duel->Opponent == playerAffectingTarget && playerAffectingAttacker->duel->State == DUEL_STATE_IN_PROGRESS)
13880 return true;
13881
13882 // PvP case - can't attack when attacker or target are in sanctuary
13883 // however, 13850 client doesn't allow to attack when one of the unit's has sanctuary flag and is pvp
13884 if (target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && (target->IsInSanctuary() || IsInSanctuary()))
13885 return false;
13886
13887 // additional checks - only PvP case
13888 if (playerAffectingAttacker && playerAffectingTarget)
13889 {
13890 if (target->IsPvP())
13891 return true;
13892
13893 if (IsFFAPvP() && target->IsFFAPvP())
13894 return true;
13895
13897 }
13898 return true;
13899}
DBCStorage< FactionEntry > sFactionStore(FactionEntryfmt)
@ TYPEMASK_DYNAMICOBJECT
Definition: ObjectGuid.h:54
@ TYPEMASK_GAMEOBJECT
Definition: ObjectGuid.h:53
@ UNIT_FIELD_BYTES_2
Definition: UpdateFields.h:161
@ DUEL_STATE_IN_PROGRESS
Definition: Player.h:373
@ PLAYER_FLAGS_UBER
Definition: Player.h:494
#define WORLD_TRIGGER
Definition: Unit.h:36
@ UNIT_BYTE2_FLAG_UNK1
Definition: Unit.h:137
@ UNIT_FLAG_TAXI_FLIGHT
Definition: Unit.h:468
@ UNIT_FLAG_NON_ATTACKABLE_2
Definition: Unit.h:464
@ UNIT_FLAG_NOT_ATTACKABLE_1
Definition: Unit.h:455
@ FACTION_FLAG_AT_WAR
Definition: DBCEnums.h:313
ReputationRank
Definition: SharedDefines.h:151
@ REP_HOSTILE
Definition: SharedDefines.h:153
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:197
uint32 type_flags
Definition: CreatureData.h:216
bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
Definition: Object.cpp:949
ReputationMgr & GetReputationMgr()
Definition: Player.h:2076
FactionTemplateEntry const * GetFactionTemplateEntry() const
Definition: Unit.cpp:10007
bool IsInCombatWith(Unit const *who) const
Definition: Unit.cpp:21163
bool IsImmuneToNPC() const
Definition: Unit.h:1683
bool IsHostileTo(Unit const *unit) const
Definition: Unit.cpp:10209
bool IsImmuneToPC() const
Definition: Unit.h:1681
Definition: ReputationMgr.h:42
FactionState const * GetState(FactionEntry const *factionEntry) const
Definition: ReputationMgr.h:82
ReputationRank const * GetForcedRankIfAny(FactionTemplateEntry const *factionTemplateEntry) const
Definition: ReputationMgr.h:107
Definition: DBCStructure.h:898
Definition: DBCStructure.h:930

References ASSERT, WorldObject::CanSeeOrDetect(), CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, Player::duel, DUEL_STATE_IN_PROGRESS, FACTION_FLAG_AT_WAR, GetAffectingPlayer(), Vehicle::GetBase(), Creature::GetCreatureTemplate(), Object::GetEntry(), GetFactionTemplateEntry(), ReputationMgr::GetForcedRankIfAny(), GetReactionTo(), Player::GetReputationMgr(), ReputationMgr::GetState(), Object::GetTypeId(), SpellInfo::HasAttribute(), Object::HasByteFlag(), HasStealthAura(), HasUnitFlag(), HasUnitState(), SpellInfo::IsAffectingArea(), IsAlive(), SpellInfo::IsAllowingDeadTarget(), IsFFAPvP(), Player::IsGameMaster(), IsHostileTo(), IsImmuneToNPC(), IsImmuneToPC(), IsInCombat(), IsInCombatWith(), IsInSanctuary(), IsOnVehicle(), IsPvP(), Object::isType(), m_vehicle, PLAYER_FLAGS_UBER, REP_HOSTILE, REP_NEUTRAL, sFactionStore, SPELL_ATTR6_CAN_TARGET_UNTARGETABLE, SPELL_ATTR6_IGNORE_PHASE_SHIFT, Object::ToCreature(), Object::ToPlayer(), CreatureTemplate::type_flags, TYPEID_PLAYER, TYPEID_UNIT, TYPEMASK_DYNAMICOBJECT, TYPEMASK_GAMEOBJECT, UNIT_BYTE2_FLAG_UNK1, UNIT_FIELD_BYTES_2, UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_NON_ATTACKABLE_2, UNIT_FLAG_NOT_ATTACKABLE_1, UNIT_FLAG_NOT_SELECTABLE, UNIT_FLAG_PLAYER_CONTROLLED, UNIT_FLAG_TAXI_FLIGHT, UNIT_STATE_UNATTACKABLE, and WORLD_TRIGGER.

Referenced by SpellInfo::CheckExplicitTarget(), Spell::DoSpellHitOnUnit(), GetMagicHitRedirectTarget(), GetMeleeHitRedirectTarget(), IsValidAttackTarget(), Acore::AnyAoETargetUnitInObjectRangeCheck::operator()(), and Acore::WorldObjectSpellTargetCheck::operator()().

◆ _RegisterAuraEffect()

void Unit::_RegisterAuraEffect ( AuraEffect aurEff,
bool  apply 
)
4629{
4630 if (apply)
4631 m_modAuras[aurEff->GetAuraType()].push_back(aurEff);
4632 else
4633 m_modAuras[aurEff->GetAuraType()].remove(aurEff);
4634}
AuraEffectList m_modAuras[TOTAL_AURAS]
Definition: Unit.h:2507
AuraType GetAuraType() const
Definition: SpellAuraEffects.cpp:447

References AuraEffect::GetAuraType(), and m_modAuras.

Referenced by AuraEffect::HandleEffect().

◆ _RegisterDynObject()

void Unit::_RegisterDynObject ( DynamicObject dynObj)
6031{
6032 m_dynObj.push_back(dynObj);
6033}

References m_dynObj.

Referenced by DynamicObject::BindToCaster().

◆ _RemoveAllAuraStatMods()

void Unit::_RemoveAllAuraStatMods ( )
5401{
5402 for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
5403 (*i).second->GetBase()->HandleAllEffects(i->second, AURA_EFFECT_HANDLE_STAT, false);
5404}

References AURA_EFFECT_HANDLE_STAT, and m_appliedAuras.

Referenced by Player::_RemoveAllStatBonuses().

◆ _removeAttacker()

void Unit::_removeAttacker ( Unit pAttacker)
inline
1363 {
1364 m_attackers.erase(pAttacker);
1365 }

References m_attackers.

Referenced by Attack(), and AttackStop().

◆ _RemoveNoStackAuraApplicationsDueToAura()

void Unit::_RemoveNoStackAuraApplicationsDueToAura ( Aura aura)

◆ _RemoveNoStackAurasDueToAura()

void Unit::_RemoveNoStackAurasDueToAura ( Aura aura)
4600{
4601 //SpellInfo const* spellProto = aura->GetSpellInfo();
4602
4603 // passive spell special case (only non stackable with ranks)
4604
4605 // xinef: this check makes caster to have 2 area auras thanks to spec switch
4606 // if (spellProto->IsPassiveStackableWithRanks())
4607 // return;
4608
4609 bool remove = false;
4610 for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
4611 {
4612 if (remove)
4613 {
4614 remove = false;
4615 i = m_appliedAuras.begin();
4616 }
4617
4618 if (aura->CanStackWith(i->second->GetBase(), true))
4619 continue;
4620
4622 if (i == m_appliedAuras.end())
4623 break;
4624 remove = true;
4625 }
4626}
@ AURA_REMOVE_BY_DEFAULT
Definition: SpellAuraDefines.h:392
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4708
bool CanStackWith(Aura const *checkAura, bool remove) const
Definition: SpellAuras.cpp:2025

References AURA_REMOVE_BY_DEFAULT, Aura::CanStackWith(), m_appliedAuras, and RemoveAura().

Referenced by _AddAura(), and _ApplyAura().

◆ _TryStackingOrRefreshingExistingAura()

Aura * Unit::_TryStackingOrRefreshingExistingAura ( SpellInfo const *  newAura,
uint8  effMask,
Unit caster,
int32 baseAmount = nullptr,
Item castItem = nullptr,
ObjectGuid  casterGUID = ObjectGuid::Empty,
bool  periodicReset = false 
)
4295{
4296 ASSERT(casterGUID || caster);
4297 if (!casterGUID)
4298 casterGUID = caster->GetGUID();
4299
4300 // Xinef: Hax for mixology, best solution qq
4301 if (sSpellMgr->GetSpellGroup(newAura->Id) == 1)
4302 return nullptr;
4303
4304 // passive and Incanter's Absorption and auras with different type can stack with themselves any number of times
4305 if (!newAura->IsMultiSlotAura())
4306 {
4307 // check if cast item changed
4308 ObjectGuid castItemGUID;
4309 if (castItem)
4310 castItemGUID = castItem->GetGUID();
4311
4312 // find current aura from spell and change it's stackamount, or refresh it's duration
4313 if (Aura* foundAura = GetOwnedAura(newAura->Id, newAura->HasAttribute(SPELL_ATTR0_CU_SINGLE_AURA_STACK) ? ObjectGuid::Empty : casterGUID, newAura->HasAttribute(SPELL_ATTR0_CU_ENCHANT_PROC) ? castItemGUID : ObjectGuid::Empty, 0))
4314 {
4315 // effect masks do not match
4316 // extremely rare case
4317 // let's just recreate aura
4318 if (effMask != foundAura->GetEffectMask())
4319 return nullptr;
4320
4321 // update basepoints with new values - effect amount will be recalculated in ModStackAmount
4322 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
4323 {
4324 if (!foundAura->HasEffect(i))
4325 continue;
4326
4327 int bp;
4328 if (baseAmount)
4329 bp = *(baseAmount + i);
4330 else
4331 bp = foundAura->GetSpellInfo()->Effects[i].BasePoints;
4332
4333 int32* oldBP = const_cast<int32*>(&(foundAura->GetEffect(i)->m_baseAmount));
4334 *oldBP = bp;
4335 }
4336
4337 // correct cast item guid if needed
4338 if (castItemGUID != foundAura->GetCastItemGUID())
4339 {
4340 ObjectGuid* oldGUID = const_cast<ObjectGuid*>(&foundAura->m_castItemGuid);
4341 *oldGUID = castItemGUID;
4342 }
4343
4344 // try to increase stack amount
4345 foundAura->ModStackAmount(1, AURA_REMOVE_BY_DEFAULT, periodicReset);
4346 sScriptMgr->OnAuraApply(this, foundAura);
4347 return foundAura;
4348 }
4349 }
4350
4351 return nullptr;
4352}
std::int32_t int32
Definition: Define.h:104
@ SPELL_ATTR0_CU_ENCHANT_PROC
Definition: SpellInfo.h:176
@ SPELL_ATTR0_CU_SINGLE_AURA_STACK
Definition: SpellInfo.h:198
#define sSpellMgr
Definition: SpellMgr.h:803
Definition: ObjectGuid.h:120
static ObjectGuid const Empty
Definition: ObjectGuid.h:122
Aura * GetOwnedAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, Aura *except=nullptr) const
Definition: Unit.cpp:4692

References ASSERT, AURA_REMOVE_BY_DEFAULT, ObjectGuid::Empty, Object::GetGUID(), GetOwnedAura(), SpellInfo::HasAttribute(), SpellInfo::Id, SpellInfo::IsMultiSlotAura(), MAX_SPELL_EFFECTS, SPELL_ATTR0_CU_ENCHANT_PROC, SPELL_ATTR0_CU_SINGLE_AURA_STACK, sScriptMgr, and sSpellMgr.

Referenced by Aura::TryRefreshStackOrCreate().

◆ _UnapplyAura() [1/2]

void Unit::_UnapplyAura ( AuraApplication aurApp,
AuraRemoveMode  removeMode 
)
4579{
4580 // aura can be removed from unit only if it's applied on it, shouldn't happen
4581 ASSERT(aurApp->GetBase()->GetApplicationOfTarget(GetGUID()) == aurApp);
4582
4583 uint32 spellId = aurApp->GetBase()->GetId();
4584 AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
4585
4586 for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
4587 {
4588 if (iter->second == aurApp)
4589 {
4590 _UnapplyAura(iter, removeMode);
4591 return;
4592 }
4593 else
4594 ++iter;
4595 }
4596 ABORT();
4597}
#define ABORT
Definition: Errors.h:76
std::pair< AuraApplicationMap::iterator, AuraApplicationMap::iterator > AuraApplicationMapBoundsNonConst
Definition: Unit.h:1301
void _UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
Definition: Unit.cpp:4498

References _UnapplyAura(), ABORT, ASSERT, Aura::GetApplicationOfTarget(), AuraApplication::GetBase(), Object::GetGUID(), Aura::GetId(), and m_appliedAuras.

◆ _UnapplyAura() [2/2]

void Unit::_UnapplyAura ( AuraApplicationMap::iterator &  i,
AuraRemoveMode  removeMode 
)
4499{
4500 AuraApplication* aurApp = i->second;
4501 ASSERT(aurApp);
4502 ASSERT(!aurApp->GetRemoveMode());
4503 ASSERT(aurApp->GetTarget() == this);
4504
4505 aurApp->SetRemoveMode(removeMode);
4506 Aura* aura = aurApp->GetBase();
4507 LOG_DEBUG("spells.aura", "Aura {} now is remove mode {}", aura->GetId(), removeMode);
4508
4509 // dead loop is killing the server probably
4510 ASSERT(m_removedAurasCount < 0xFFFFFFFF);
4511
4513
4514 Unit* caster = aura->GetCaster();
4515
4516 // Remove all pointers from lists here to prevent possible pointer invalidation on spellcast/auraapply/auraremove
4517 m_appliedAuras.erase(i);
4518
4519 // xinef: do not insert our application to interruptible list if application target is not the owner (area auras)
4520 // xinef: event if it gets removed, it will be reapplied in a second
4521 if (aura->GetSpellInfo()->AuraInterruptFlags && this == aura->GetOwner())
4522 {
4523 m_interruptableAuras.remove(aurApp);
4525 }
4526
4527 bool auraStateFound = false;
4528 AuraStateType auraState = aura->GetSpellInfo()->GetAuraState();
4529 if (auraState)
4530 {
4531 bool canBreak = false;
4532 // Get mask of all aurastates from remaining auras
4533 for (AuraStateAurasMap::iterator itr = m_auraStateAuras.lower_bound(auraState); itr != m_auraStateAuras.upper_bound(auraState) && !(auraStateFound && canBreak);)
4534 {
4535 if (itr->second == aurApp)
4536 {
4537 m_auraStateAuras.erase(itr);
4538 itr = m_auraStateAuras.lower_bound(auraState);
4539 canBreak = true;
4540 continue;
4541 }
4542 auraStateFound = true;
4543 ++itr;
4544 }
4545 }
4546
4547 aurApp->_Remove();
4548 aura->_UnapplyForTarget(this, caster, aurApp);
4549
4550 // remove effects of the spell - needs to be done after removing aura from lists
4551 for (uint8 itr = 0; itr < MAX_SPELL_EFFECTS; ++itr)
4552 {
4553 if (aurApp->HasEffect(itr))
4554 aurApp->_HandleEffect(itr, false);
4555 }
4556
4557 // all effect mustn't be applied
4558 ASSERT(!aurApp->GetEffectMask());
4559
4560 // Remove totem at next update if totem loses its aura
4561 if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE && IsTotem() && GetGUID() == aura->GetCasterGUID())
4562 {
4563 if (ToTotem()->GetSpell() == aura->GetId() && ToTotem()->GetTotemType() == TOTEM_PASSIVE)
4565 }
4566
4567 // Remove aurastates only if were not found
4568 if (!auraStateFound)
4569 ModifyAuraState(auraState, false);
4570
4571 aura->HandleAuraSpecificMods(aurApp, caster, false, false);
4572
4573 // only way correctly remove all auras from list
4574 //if (removedAuras != m_removedAurasCount) new aura may be added
4575 i = m_appliedAuras.begin();
4576}
@ TOTEM_PASSIVE
Definition: Totem.h:25
@ AURA_REMOVE_BY_EXPIRE
Definition: SpellAuraDefines.h:395
void setDeathState(DeathState s, bool despawn=false) override
Definition: TemporarySummon.cpp:396
Totem * ToTotem()
Definition: Unit.h:2399
void UpdateInterruptMask()
Definition: Unit.cpp:759
bool IsTotem() const
Definition: Unit.h:1415
void SetRemoveMode(AuraRemoveMode mode)
Definition: SpellAuras.h:72
void _Remove()
Definition: SpellAuras.cpp:94
bool HasEffect(uint8 effect) const
Definition: SpellAuras.h:67
virtual void _UnapplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
Definition: SpellAuras.cpp:515

References AuraApplication::_HandleEffect(), AuraApplication::_Remove(), Aura::_UnapplyForTarget(), ASSERT, AURA_REMOVE_BY_EXPIRE, SpellInfo::AuraInterruptFlags, SpellInfo::GetAuraState(), AuraApplication::GetBase(), Aura::GetCaster(), Aura::GetCasterGUID(), AuraApplication::GetEffectMask(), Object::GetGUID(), Aura::GetId(), Aura::GetOwner(), AuraApplication::GetRemoveMode(), Aura::GetSpellInfo(), AuraApplication::GetTarget(), Aura::HandleAuraSpecificMods(), AuraApplication::HasEffect(), IsTotem(), JUST_DIED, LOG_DEBUG, m_appliedAuras, m_auraStateAuras, m_interruptableAuras, m_removedAurasCount, MAX_SPELL_EFFECTS, ModifyAuraState(), Minion::setDeathState(), AuraApplication::SetRemoveMode(), TOTEM_PASSIVE, ToTotem(), and UpdateInterruptMask().

Referenced by Aura::_Remove(), _UnapplyAura(), RemoveAllAuras(), RemoveAllAurasExceptType(), RemoveAllAurasOnDeath(), RemoveAllAurasRequiringDeadTarget(), RemoveAura(), and RemoveEvadeAuras().

◆ _UnregisterDynObject()

void Unit::_UnregisterDynObject ( DynamicObject dynObj)
6036{
6037 m_dynObj.remove(dynObj);
6038}

References m_dynObj.

Referenced by DynamicObject::UnbindFromCaster().

◆ _UpdateAutoRepeatSpell()

void Unit::_UpdateAutoRepeatSpell ( )
protected
3854{
3855 SpellInfo const* spellProto = nullptr;
3857 {
3859 }
3860
3861 if (!spellProto)
3862 {
3863 return;
3864 }
3865
3866 static uint32 const HUNTER_AUTOSHOOT = 75;
3867
3868 // Check "realtime" interrupts
3869 if ((GetTypeId() == TYPEID_PLAYER && ToPlayer()->isMoving() && spellProto->Id != HUNTER_AUTOSHOOT) || IsNonMeleeSpellCast(false, false, true, spellProto->Id == HUNTER_AUTOSHOOT))
3870 {
3871 // cancel wand shoot
3872 if (spellProto->Id != HUNTER_AUTOSHOOT)
3874 m_AutoRepeatFirstCast = true;
3875 return;
3876 }
3877
3878 // Apply delay (Hunter's autoshoot not affected)
3879 if (m_AutoRepeatFirstCast && getAttackTimer(RANGED_ATTACK) < 500 && spellProto->Id != HUNTER_AUTOSHOOT)
3880 {
3882 }
3883
3884 m_AutoRepeatFirstCast = false;
3885
3886 // Check for ranged attack timer
3888 {
3890 if (result != SPELL_CAST_OK)
3891 {
3892 if (spellProto->Id != HUNTER_AUTOSHOOT)
3893 {
3895 }
3896
3897 return;
3898 }
3899
3900 // We want to shoot
3901 Spell* spell = new Spell(this, spellProto, TRIGGERED_FULL_MASK);
3902 spell->prepare(&(m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_targets));
3903
3904 // Reset attack
3906 }
3907}
@ CURRENT_AUTOREPEAT_SPELL
Definition: Unit.h:981
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
Definition: SpellDefines.h:148
SpellCastResult
Definition: SharedDefines.h:920
@ SPELL_CAST_OK
Definition: SharedDefines.h:1110
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
Definition: Unit.cpp:4002
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition: Unit.cpp:4039
void setAttackTimer(WeaponAttackType type, int32 time)
Definition: Unit.h:1340
bool isMoving() const
Definition: Unit.h:2380
int32 getAttackTimer(WeaponAttackType type) const
Definition: Unit.h:1342
bool isAttackReady(WeaponAttackType type=BASE_ATTACK) const
Definition: Unit.h:1343
void resetAttackTimer(WeaponAttackType type=BASE_ATTACK)
Definition: Unit.cpp:661
Definition: Spell.h:284
SpellCastResult prepare(SpellCastTargets const *targets, AuraEffect const *triggeredByAura=nullptr)
Definition: Spell.cpp:3450
SpellCastResult CheckCast(bool strict)
Definition: Spell.cpp:5612
SpellInfo const *const m_spellInfo
Definition: Spell.h:520

References Spell::CheckCast(), CURRENT_AUTOREPEAT_SPELL, getAttackTimer(), Object::GetTypeId(), SpellInfo::Id, InterruptSpell(), isAttackReady(), isMoving(), IsNonMeleeSpellCast(), m_AutoRepeatFirstCast, m_currentSpells, Spell::m_spellInfo, Spell::prepare(), RANGED_ATTACK, resetAttackTimer(), setAttackTimer(), SPELL_CAST_OK, Object::ToPlayer(), TRIGGERED_FULL_MASK, and TYPEID_PLAYER.

Referenced by _UpdateSpells().

◆ _UpdateSpells()

void Unit::_UpdateSpells ( uint32  time)
protected
3798{
3801
3802 // remove finished spells from current pointers
3803 for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i)
3804 {
3805 if (m_currentSpells[i] && m_currentSpells[i]->getState() == SPELL_STATE_FINISHED)
3806 {
3808 m_currentSpells[i] = nullptr; // remove pointer
3809 }
3810 }
3811
3812 // m_auraUpdateIterator can be updated in indirect called code at aura remove to skip next planned to update but removed auras
3814 {
3815 Aura* i_aura = m_auraUpdateIterator->second;
3816 ++m_auraUpdateIterator; // need shift to next for allow update if need into aura update
3817 i_aura->UpdateOwner(time, this);
3818 }
3819
3820 // remove expired auras - do that after updates(used in scripts?)
3821 for (AuraMap::iterator i = m_ownedAuras.begin(); i != m_ownedAuras.end();)
3822 {
3823 if (i->second->IsExpired())
3825 else
3826 ++i;
3827 }
3828
3829 for (VisibleAuraMap::iterator itr = m_visibleAuras.begin(); itr != m_visibleAuras.end(); ++itr)
3830 if (itr->second->IsNeedClientUpdate())
3831 itr->second->ClientUpdate();
3832
3834
3835 if (!m_gameObj.empty())
3836 {
3837 for (GameObjectList::iterator itr = m_gameObj.begin(); itr != m_gameObj.end();)
3838 {
3839 if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr))
3840 if (!go->isSpawned())
3841 {
3842 go->SetOwnerGUID(ObjectGuid::Empty);
3843 go->SetRespawnTime(0);
3844 go->Delete();
3845 m_gameObj.erase(itr++);
3846 continue;
3847 }
3848 ++itr;
3849 }
3850 }
3851}
@ SPELL_STATE_FINISHED
Definition: Spell.h:226
GameObject * GetGameObject(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:189
Definition: GameObject.h:813
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4637
void _UpdateAutoRepeatSpell()
Definition: Unit.cpp:3853
VisibleAuraMap m_visibleAuras
Definition: Unit.h:2516
void UpdateOwner(uint32 diff, WorldObject *owner)
Definition: SpellAuras.cpp:770

References _DeleteRemovedAuras(), _UpdateAutoRepeatSpell(), AURA_REMOVE_BY_EXPIRE, CURRENT_AUTOREPEAT_SPELL, CURRENT_MAX_SPELL, ObjectGuid::Empty, ObjectAccessor::GetGameObject(), m_auraUpdateIterator, m_currentSpells, m_gameObj, m_ownedAuras, m_visibleAuras, RemoveOwnedAura(), Spell::SetReferencedFromCurrent(), SPELL_STATE_FINISHED, and Aura::UpdateOwner().

Referenced by Update().

◆ AddAura() [1/2]

Aura * Unit::AddAura ( SpellInfo const *  spellInfo,
uint8  effMask,
Unit target 
)
19017{
19018 if (!spellInfo)
19019 return nullptr;
19020
19021 if (target->IsImmunedToSpell(spellInfo))
19022 return nullptr;
19023
19024 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
19025 {
19026 if (!(effMask & (1 << i)))
19027 continue;
19028 if (target->IsImmunedToSpellEffect(spellInfo, i))
19029 effMask &= ~(1 << i);
19030 }
19031
19032 if (Aura* aura = Aura::TryRefreshStackOrCreate(spellInfo, effMask, target, this))
19033 {
19034 aura->ApplyForTargets();
19035 return aura;
19036 }
19037 return nullptr;
19038}
virtual bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, uint32 index) const
Definition: Unit.cpp:12922
virtual bool IsImmunedToSpell(SpellInfo const *spellInfo, Spell const *spell=nullptr)
Definition: Unit.cpp:12832
static Aura * TryRefreshStackOrCreate(SpellInfo const *spellproto, uint8 tryEffMask, WorldObject *owner, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, bool *refresh=nullptr, bool periodicReset=false)
Definition: SpellAuras.cpp:326

References Aura::ApplyForTargets(), IsImmunedToSpell(), IsImmunedToSpellEffect(), MAX_SPELL_EFFECTS, and Aura::TryRefreshStackOrCreate().

◆ AddAura() [2/2]

Aura * Unit::AddAura ( uint32  spellId,
Unit target 
)
19002{
19003 if (!target)
19004 return nullptr;
19005
19006 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
19007 if (!spellInfo)
19008 return nullptr;
19009
19010 if (!target->IsAlive() && !spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !spellInfo->HasAttribute(SPELL_ATTR2_ALLOW_DEAD_TARGET))
19011 return nullptr;
19012
19013 return AddAura(spellInfo, MAX_EFFECT_MASK, target);
19014}
#define MAX_EFFECT_MASK
Definition: DBCStructure.h:1597
@ SPELL_ATTR2_ALLOW_DEAD_TARGET
Definition: SharedDefines.h:428
@ SPELL_ATTR0_PASSIVE
Definition: SharedDefines.h:360
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:19001
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:412

References AddAura(), SpellInfo::HasAttribute(), IsAlive(), MAX_EFFECT_MASK, SPELL_ATTR0_PASSIVE, SPELL_ATTR2_ALLOW_DEAD_TARGET, and sSpellMgr.

Referenced by AddAura(), boss_grand_champion::boss_grand_championAI::AddCreatureAddonAuras(), Pet::AddToWorld(), npc_ritual_channeler::npc_ritual_channelerAI::AttackStart(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::AttackStart(), boss_anzu::boss_anzuAI::boss_anzuAI(), boss_the_lich_king::boss_the_lich_kingAI::boss_the_lich_kingAI(), boss_twilight_halion::boss_twilight_halionAI::boss_twilight_halionAI(), npc_auriaya_feral_defender::npc_auriaya_feral_defenderAI::DoAction(), UnitAI::DoAddAuraToAllHostilePlayers(), Spell::DoTriggersOnSpellHit(), boss_gahzranka::boss_gahzrankaAI::EnterCombat(), boss_freya::boss_freyaAI::EnterCombat(), npc_dalaran_warrior::npc_dalaran_warriorAI::EnterCombat(), boss_prince_keleseth_icc::boss_prince_kelesethAI::EnterCombat(), boss_prince_taldaram_icc::boss_prince_taldaramAI::EnterCombat(), boss_prince_valanar_icc::boss_prince_valanarAI::EnterCombat(), npc_anubisath_sentinel::aqsentinelAI::GainSentinelAbility(), AuraEffect::HandleAuraDummy(), Aura::HandleAuraSpecificMods(), deserter_commandscript::HandleDeserterAdd(), gm_commandscript::HandleGMVisibleCommand(), spell_oculus_rider_aura::spell_oculus_rider_auraAuraScript::HandleOnEffectApply(), spell_transitus_shield_beam::spell_transitus_shield_beam_AuraScript::HandleOnEffectApply(), npc_pet_dk_dancing_rune_weapon::npc_pet_dk_dancing_rune_weaponAI::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), Guardian::InitStatsForLevel(), boss_the_lich_king::boss_the_lich_kingAI::JustReachedHome(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), Creature::LoadCreaturesAddon(), npc_brew_bubble::MoveInLineOfSight(), npc_scarlet_guard::npc_scarlet_guardAI::MoveInLineOfSight(), npc_pet_gen_plump_turkey::MovementInform(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), spell_yogg_saron_empowered::spell_yogg_saron_empowered_AuraScript::OnPeriodic(), instance_stratholme::instance_stratholme_InstanceMapScript::OnPlayerEnter(), BattlefieldWG::OnPlayerEnterZone(), AreaTrigger_at_area_52_entrance::OnTrigger(), Player::ProcessDelayedOperations(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), npc_corrupted_totem::Reset(), npc_troll_volunteer::npc_troll_volunteerAI::Reset(), npc_vengeful_shade::npc_vengeful_shadeAI::Reset(), boss_magus_telestra::boss_magus_telestraAI::Reset(), npc_auriaya_feral_defender::npc_auriaya_feral_defenderAI::Reset(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::Reset(), boss_archavon::boss_archavonAI::Reset(), boss_emalon::boss_emalonAI::Reset(), boss_koralon::boss_koralonAI::Reset(), boss_toravon::boss_toravonAI::Reset(), npc_dalaran_mage::npc_dalaran_mageAI::Reset(), npc_pet_gen_argent_pony_bridle::Reset(), npc_pet_pri_shadowfiend::Reset(), Player::SendInitialPacketsAfterAddToMap(), npc_corrupted_totem::SetAura(), SetAuraStack(), Player::SetGMVisible(), Player::SetIsSpectator(), npc_artorius::npc_artoriusAI::SpellHit(), npc_simone::npc_simoneAI::SpellHit(), npc_nelson::npc_nelsonAI::SpellHit(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::SpellHitTarget(), Spell::SummonGuardian(), boss_gyth::boss_gythAI::UpdateAI(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::UpdateAI(), boss_netherspite::boss_netherspiteAI::UpdateAI(), npc_tiger_matriarch_credit::npc_tiger_matriarch_creditAI::UpdateAI(), npc_tiger_matriarch::npc_tiger_matriarchAI::UpdateAI(), boss_sister_svalna::boss_sister_svalnaAI::UpdateAI(), npc_boss_gothik_minion::npc_boss_gothik_minionAI::UpdateAI(), boss_freya_elder_brightleaf::boss_freya_elder_brightleafAI::UpdateAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::UpdateAI(), boss_shirrak_the_dead_watcher::boss_shirrak_the_dead_watcherAI::UpdateAI(), npc_voidtraveler::npc_voidtravelerAI::UpdateAI(), boss_kelidan_the_breaker::boss_kelidan_the_breakerAI::UpdateAI(), npc_pet_gen_toxic_wasteling::UpdateAI(), boss_netherspite::boss_netherspiteAI::UpdatePortals(), and npc_emily::npc_emilyAI::WaypointReached().

◆ AddComboPointHolder()

void Unit::AddComboPointHolder ( Unit unit)
inline
2299{ m_ComboPointHolders.insert(unit); }
std::unordered_set< Unit * > m_ComboPointHolders
Definition: Unit.h:2582

References m_ComboPointHolders.

Referenced by AddComboPoints().

◆ AddComboPoints() [1/2]

void Unit::AddComboPoints ( int8  count)
inline
2295{ AddComboPoints(nullptr, count); }
void AddComboPoints(Unit *target, int8 count)
Definition: Unit.cpp:16983

References AddComboPoints().

Referenced by AddComboPoints().

◆ AddComboPoints() [2/2]

void Unit::AddComboPoints ( Unit target,
int8  count 
)
16984{
16985 if (!count)
16986 {
16987 return;
16988 }
16989
16990 if (target && target != m_comboTarget)
16991 {
16992 if (m_comboTarget)
16993 {
16995 }
16996
16997 m_comboTarget = target;
16998 m_comboPoints = count;
16999 target->AddComboPointHolder(this);
17000 }
17001 else
17002 {
17003 m_comboPoints = std::max<int8>(std::min<int8>(m_comboPoints + count, 5), 0);
17004 }
17005
17007}
void SendComboPoints()
Definition: Unit.cpp:17026
void AddComboPointHolder(Unit *unit)
Definition: Unit.h:2299
void RemoveComboPointHolder(Unit *unit)
Definition: Unit.h:2300

References AddComboPointHolder(), m_comboPoints, m_comboTarget, RemoveComboPointHolder(), and SendComboPoints().

Referenced by Spell::_handle_finish_phase(), AuraEffect::HandleAuraRetainComboPoints(), and ProcDamageAndSpellFor().

◆ AddExtraAttacks()

void Unit::AddExtraAttacks ( uint32  count)
2728{
2730 if (!targetGUID)
2731 {
2732 if (ObjectGuid selection = GetTarget())
2733 {
2734 targetGUID = selection; // Spell was cast directly (not triggered by aura)
2735 }
2736 else
2737 return;
2738 }
2739
2740 extraAttacksTargets[targetGUID] += count;
2741}
std::unordered_map< ObjectGuid, uint32 > extraAttacksTargets
Definition: Unit.h:2595
ObjectGuid _lastDamagedTargetGuid
Definition: Unit.h:2596
ObjectGuid GetTarget() const
Definition: Unit.h:2433

References _lastDamagedTargetGuid, extraAttacksTargets, and GetTarget().

Referenced by Spell::EffectAddExtraAttacks().

◆ AddExtraUnitMovementFlag()

void Unit::AddExtraUnitMovementFlag ( uint16  f)
inline
2278{ m_movementInfo.flags2 |= f; }
uint16 flags2
Definition: Object.h:268
MovementInfo m_movementInfo
Definition: Object.h:595

References MovementInfo::flags2, and WorldObject::m_movementInfo.

Referenced by Vehicle::InitMovementInfoForBase().

◆ addFollower()

void Unit::addFollower ( FollowerReference pRef)
inline
void insertFirst(LinkedListElement *pElem)
Definition: LinkedList.h:105
FollowerRefMgr m_FollowingRefMgr
Definition: Unit.h:2578

References LinkedListHead::insertFirst(), and m_FollowingRefMgr.

Referenced by FollowerReference::targetObjectBuildLink().

◆ AddGameObject()

void Unit::AddGameObject ( GameObject gameObj)
6092{
6093 if (!gameObj || gameObj->GetOwnerGUID())
6094 return;
6095
6096 m_gameObj.push_back(gameObj->GetGUID());
6097 gameObj->SetOwnerGUID(GetGUID());
6098
6099 if (GetTypeId() == TYPEID_PLAYER && gameObj->GetSpellId())
6100 {
6101 SpellInfo const* createBySpell = sSpellMgr->GetSpellInfo(gameObj->GetSpellId());
6102 // Need disable spell use for owner
6103 if (createBySpell && createBySpell->IsCooldownStartedOnEvent())
6104 // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
6105 ToPlayer()->AddSpellAndCategoryCooldowns(createBySpell, 0, nullptr, true);
6106 }
6107}
uint32 GetSpellId() const
Definition: GameObject.h:874
void SetOwnerGUID(ObjectGuid owner)
Definition: GameObject.h:856
ObjectGuid GetOwnerGUID() const
Definition: GameObject.h:866
void AddSpellAndCategoryCooldowns(SpellInfo const *spellInfo, uint32 itemId, Spell *spell=nullptr, bool infinityCooldown=false)
Definition: Player.cpp:10786
bool IsCooldownStartedOnEvent() const
Definition: SpellInfo.cpp:1196

References Player::AddSpellAndCategoryCooldowns(), Object::GetGUID(), GameObject::GetOwnerGUID(), GameObject::GetSpellId(), Object::GetTypeId(), SpellInfo::IsCooldownStartedOnEvent(), m_gameObj, GameObject::SetOwnerGUID(), sSpellMgr, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by Spell::EffectDuel(), Spell::EffectSummonObject(), Spell::EffectTransmitted(), and WorldObject::SummonGameObject().

◆ addHatedBy()

void Unit::addHatedBy ( HostileReference pHostileReference)
inline

◆ AddInterruptMask()

void Unit::AddInterruptMask ( uint32  mask)
inline
2163{ m_interruptMask |= mask; }

References m_interruptMask.

Referenced by _CreateAuraApplication(), and Spell::handle_immediate().

◆ AddPetAura()

void Unit::AddPetAura ( PetAura const *  petSpell)
17432{
17433 if (GetTypeId() != TYPEID_PLAYER)
17434 return;
17435
17436 m_petAuras.insert(petSpell);
17437 if (Pet* pet = ToPlayer()->GetPet())
17438 pet->CastPetAura(petSpell);
17439 else if (Unit* charm = GetCharm())
17440 charm->CastPetAura(petSpell);
17441}
Pet * GetPet(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:220
Definition: Pet.h:40
Unit * GetCharm() const
Definition: Unit.cpp:10626
PetAuraSet m_petAuras
Definition: Unit.h:2334

References GetCharm(), Object::GetTypeId(), m_petAuras, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by Spell::EffectDummy(), and AuraEffect::HandleAuraDummy().

◆ AddPlayerToVision()

void Unit::AddPlayerToVision ( Player player)
11130{
11131 if (m_sharedVision.empty())
11132 {
11133 setActive(true);
11134 SetWorldObject(true);
11135 }
11136 m_sharedVision.push_back(player);
11137 player->m_isInSharedVisionOf.insert(this);
11138}
void SetWorldObject(bool apply)
Definition: Object.cpp:1066
void setActive(bool isActiveObject)
Definition: Object.cpp:1085

References Player::m_isInSharedVisionOf, m_sharedVision, WorldObject::setActive(), and WorldObject::SetWorldObject().

◆ AddPointedBy()

void Unit::AddPointedBy ( SafeUnitPointer sup)
inline
2405{ SafeUnitPointerSet.insert(sup); }
std::set< SafeUnitPointer * > SafeUnitPointerSet
Definition: Unit.h:2404

References SafeUnitPointerSet.

Referenced by SafeUnitPointer::SetPointedTo().

◆ AddSpellCooldown()

virtual void Unit::AddSpellCooldown ( uint32  ,
uint32  ,
uint32  ,
bool  needSendToClient = false,
bool  forceSendToSpectator = false 
)
inlinevirtual

◆ AddThreat()

void Unit::AddThreat ( Unit victim,
float  fThreat,
SpellSchoolMask  schoolMask = SPELL_SCHOOL_MASK_NORMAL,
SpellInfo const *  threatSpell = nullptr 
)
14544{
14545 // Only mobs can manage threat lists
14547 {
14548 m_ThreatMgr.AddThreat(victim, fThreat, schoolMask, threatSpell);
14549 }
14550}
@ UNIT_STATE_EVADE
Definition: Unit.h:346
void AddThreat(Unit *victim, float threat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition: ThreatMgr.cpp:437
bool CanHaveThreatList() const
Definition: Unit.cpp:14504
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1398

References ThreatMgr::AddThreat(), CanHaveThreatList(), HasUnitState(), m_ThreatMgr, and UNIT_STATE_EVADE.

Referenced by Attack(), npc_ritual_channeler::npc_ritual_channelerAI::AttackStart(), boss_alyson_antille::boss_alyson_antilleAI::AttackStart(), boss_gazakrothAI::AttackStart(), boss_slither::boss_slitherAI::AttackStart(), npc_vengeful_shade::npc_vengeful_shadeAI::AttackStart(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::AttackStart(), prince_axes::prince_axesAI::changetarget(), npc_dirt_mound::ChaseNewTarget(), boss_buru::ChaseNewVictim(), npc_dark_nucleus::npc_dark_nucleusAI::DamageTaken(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DamageTaken(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DamageTaken(), boss_prince_valanar_icc::boss_prince_valanarAI::DamageTaken(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), DealDamage(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), npc_living_constellation::npc_living_constellationAI::DoAction(), CreatureAI::DoZoneInCombat(), Spell::EffectThreat(), boss_buru::EnterCombat(), boss_sapphiron::boss_sapphironAI::EnterCombatSelfFunction(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), AuraEffect::HandleAuraDummy(), spell_morogrim_tidewalker_water_globule_new_target::spell_morogrim_tidewalker_water_globule_new_target_SpellScript::HandleDummy(), HandleDummyAuraProc(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_teron_gorefiend_shadowy_construct::spell_teron_gorefiend_shadowy_construct_AuraScript::HandleEffectApply(), AuraEffect::HandlePeriodicManaLeechAuraTick(), spell_frostwarden_handler_focus_fire::spell_frostwarden_handler_focus_fire_SpellScript::HandleScript(), spell_the_lich_king_vile_spirit_move_target_search::spell_the_lich_king_vile_spirit_move_target_search_SpellScript::HandleScript(), spell_pursue::spell_pursue_SpellScript::HandleScript(), Spell::HandleThreatSpells(), npc_tiger_matriarch::npc_tiger_matriarchAI::IsSummonedBy(), npc_little_ooze::npc_little_oozeAI::IsSummonedBy(), npc_daphne_stilwell::npc_daphne_stilwellAI::JustSummoned(), npc_hor_lich_king::npc_hor_lich_kingAI::JustSummoned(), boss_curator::boss_curatorAI::JustSummoned(), boss_sacrolash::boss_sacrolashAI::JustSummoned(), boss_devourer_of_souls::boss_devourer_of_soulsAI::JustSummoned(), npc_akama_illidan::npc_akama_illidanAI::JustSummoned(), npc_creature_generator_akama::npc_creature_generator_akamaAI::JustSummoned(), boss_nethermancer_sepethrea::boss_nethermancer_sepethreaAI::JustSummoned(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), npc_pet_hunter_snake_trap::MoveInLineOfSight(), npc_gunship_mage::npc_gunship_mageAI::MovementInform(), npc_pet_mage_mirror_image::MySelectNextTarget(), SmartScript::ProcessAction(), RemoveCharmedBy(), npc_swarm_scarab::npc_swarm_scarabAI::Reset(), boss_skarvald_the_constructor::boss_skarvald_the_constructorAI::Reset(), boss_dalronn_the_controller::boss_dalronn_the_controllerAI::Reset(), npc_pet_hunter_snake_trap::Reset(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::SelectT(), npc_varian_wrynn::npc_varian_wrynnAI::SpawnWave(), npc_thrall_bfu::npc_thrall_bfuAI::SpawnWave(), npc_enslaved_netherwing_drake::npc_enslaved_netherwing_drakeAI::SpellHit(), npc_greengill_slave::npc_greengill_slaveAI::SpellHit(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::SpellHitTarget(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::SpellHitTarget(), spell_putricide_ooze_channel::spell_putricide_ooze_channel_SpellScript::StartAttack(), brann_bronzebeard::brann_bronzebeardAI::SummonCreatures(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_kagani_nightstrike::boss_kagani_nightstrikeAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), boss_akilzon::boss_akilzonAI::UpdateAI(), npc_giant_infernal::npc_giant_infernalAI::UpdateAI(), boss_sartura::UpdateAI(), npc_sartura_royal_guard::UpdateAI(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), npc_fel_infernal::npc_fel_infernalAI::UpdateAI(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::UpdateAI(), boss_eck::boss_eckAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_addAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_skarvald_the_constructor::boss_skarvald_the_constructorAI::UpdateAI(), npc_frozen_orb::npc_frozen_orbAI::UpdateAI(), npc_hourglass_of_eternity::npc_hourglass_of_eternityAI::UpdateAI(), boss_shade_of_akama::boss_shade_of_akamaAI::UpdateAI(), boss_supremus::boss_supremusAI::UpdateAI(), boss_warbringer_omrogg::boss_warbringer_omroggAI::UpdateAI(), boss_anetheron::boss_anetheronAI::WaypointReached(), boss_azgalor::boss_azgalorAI::WaypointReached(), boss_kazrogal::boss_kazrogalAI::WaypointReached(), boss_rage_winterchill::boss_rage_winterchillAI::WaypointReached(), npc_giant_infernal::npc_giant_infernalAI::WaypointReached(), npc_abomination::npc_abominationAI::WaypointReached(), npc_ghoul::npc_ghoulAI::WaypointReached(), npc_necromancer::npc_necromancerAI::WaypointReached(), npc_banshee::npc_bansheeAI::WaypointReached(), npc_crypt_fiend::npc_crypt_fiendAI::WaypointReached(), npc_fel_stalker::npc_fel_stalkerAI::WaypointReached(), npc_frost_wyrm::npc_frost_wyrmAI::WaypointReached(), and npc_gargoyle::npc_gargoyleAI::WaypointReached().

◆ AddToWorld()

void Unit::AddToWorld ( )
overridevirtual

Reimplemented from WorldObject.

15576{
15577 if (!IsInWorld())
15578 {
15580 }
15581}
void AddToWorld() override
Definition: Object.cpp:1176

References WorldObject::AddToWorld(), and Object::IsInWorld().

Referenced by Creature::AddToWorld(), Pet::AddToWorld(), and Player::AddToWorld().

◆ AddUnitMovementFlag()

◆ AddUnitState()

void Unit::AddUnitState ( uint32  f)
inline
1397{ m_state |= f; }

References m_state.

Referenced by _ExitVehicle(), RandomMovementGenerator< T >::_setRandomLocation(), MotionTransport::AddPassenger(), Attack(), boss_prince_keleseth_icc::boss_prince_kelesethAI::boss_prince_kelesethAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::boss_prince_taldaramAI(), boss_prince_valanar_icc::boss_prince_valanarAI::boss_prince_valanarAI(), Creature::Create(), MotionTransport::CreateNPCPassenger(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_hungarfen::DamageTaken(), boss_thorim::boss_thorimAI::DisableThorim(), WaypointMovementGenerator< Creature >::DoInitialize(), RandomMovementGenerator< T >::DoInitialize(), ChaseMovementGenerator< T >::DoInitialize(), WaypointMovementGenerator< Creature >::DoReset(), FlightPathMovementGenerator::DoReset(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::EnableSara(), boss_jindo::EnterEvadeMode(), CreatureAI::EnterEvadeMode(), SmartAI::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), Creature::FocusTarget(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), AuraEffect::HandleAuraModSchoolImmunity(), debug_commandscript::HandleDebugUnitStateCommand(), AuraEffect::HandleFeignDeath(), WorldSession::HandlePetCastSpellOpcode(), RotateMovementGenerator::Initialize(), DistractMovementGenerator::Initialize(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::InitializeAI(), Player::LoadFromDB(), boss_ayamiss::MovementInform(), npc_pet_gen_moth::npc_pet_gen_moth(), npc_pet_gen_valkyr_guardian::npc_pet_gen_valkyr_guardian(), npc_pet_gen_wind_rider_cub::npc_pet_gen_wind_rider_cub(), npc_corrupted_totem::Reset(), npc_batrider::Reset(), boss_jedoga_shadowseeker::Reset(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::Reset(), npc_ulduar_mimiron_rocket::npc_ulduar_mimiron_rocketAI::Reset(), npc_wild_wyrm::npc_wild_wyrmAI::Reset(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::Reset(), SetCharmedBy(), SetContestedPvP(), SetControlled(), SetCurrentCastedSpell(), Player::setDeathState(), Player::SetIsSpectator(), boss_urom::boss_uromAI::SpellHit(), WaypointMovementGenerator< Creature >::StartMove(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), and boss_svala::boss_svalaAI::UpdateAI().

◆ AddUnitTypeMask()

void Unit::AddUnitTypeMask ( uint32  mask)
inline
1408{ m_unitTypeMask |= mask; }

References m_unitTypeMask.

◆ ApplyAttackTimePercentMod()

void Unit::ApplyAttackTimePercentMod ( WeaponAttackType  att,
float  val,
bool  apply 
)
17200{
17201 float remainingTimePct = std::max((float)m_attackTimer[att], 0.0f) / (GetAttackTime(att) * m_modAttackSpeedPct[att]);
17202 if (val > 0)
17203 {
17205 ApplyPercentModFloatValue(static_cast<uint16>(UNIT_FIELD_BASEATTACKTIME) + att, val, !apply);
17206 }
17207 else
17208 {
17210 ApplyPercentModFloatValue(static_cast<uint16>(UNIT_FIELD_BASEATTACKTIME) + att, -val, apply);
17211 }
17212 m_attackTimer[att] = uint32(GetAttackTime(att) * m_modAttackSpeedPct[att] * remainingTimePct);
17213}
std::uint16_t uint16
Definition: Define.h:109
void ApplyPercentModFloatVar(float &var, float val, bool apply)
Definition: Util.h:50
@ UNIT_FIELD_BASEATTACKTIME
Definition: UpdateFields.h:120
void ApplyPercentModFloatValue(uint16 index, float val, bool apply)
Definition: Object.cpp:829
uint32 GetAttackTime(WeaponAttackType att) const
Definition: Unit.h:1469

References Object::ApplyPercentModFloatValue(), ApplyPercentModFloatVar(), GetAttackTime(), m_attackTimer, m_modAttackSpeedPct, and UNIT_FIELD_BASEATTACKTIME.

Referenced by Player::ApplyRatingMod(), AuraEffect::HandleAuraModRangedHaste(), AuraEffect::HandleModAttackSpeed(), AuraEffect::HandleModCombatSpeedPct(), AuraEffect::HandleModMeleeRangedSpeedPct(), AuraEffect::HandleModMeleeSpeedPct(), and AuraEffect::HandleRangedAmmoHaste().

◆ ApplyCastTimePercentMod()

void Unit::ApplyCastTimePercentMod ( float  val,
bool  apply 
)
17216{
17217 if (val > 0)
17219 else
17221}
@ UNIT_MOD_CAST_SPEED
Definition: UpdateFields.h:137

References Object::ApplyPercentModFloatValue(), and UNIT_MOD_CAST_SPEED.

Referenced by Player::ApplyRatingMod(), AuraEffect::HandleModCastingSpeed(), and AuraEffect::HandleModCombatSpeedPct().

◆ ApplyDiminishingAura()

void Unit::ApplyDiminishingAura ( DiminishingGroup  group,
bool  apply 
)
15014{
15015 // Checking for existing in the table
15016 for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i)
15017 {
15018 if (i->DRGroup != group)
15019 continue;
15020
15021 if (apply)
15022 i->stack += 1;
15023 else if (i->stack)
15024 {
15025 i->stack -= 1;
15026 // Remember time after last aura from group removed
15027 if (i->stack == 0)
15028 i->hitTime = GameTime::GetGameTimeMS().count();
15029 }
15030 break;
15031 }
15032}
Milliseconds GetGameTimeMS()
Definition: GameTime.cpp:43
Diminishing m_Diminishing
Definition: Unit.h:2574

References GameTime::GetGameTimeMS(), and m_Diminishing.

Referenced by UnitAura::_ApplyForTarget(), and UnitAura::_UnapplyForTarget().

◆ ApplyDiminishingToDuration()

float Unit::ApplyDiminishingToDuration ( DiminishingGroup  group,
int32 duration,
Unit caster,
DiminishingLevels  Level,
int32  limitduration 
)
14935{
14936 // xinef: dont apply diminish to self casts
14937 if (duration == -1 || group == DIMINISHING_NONE)
14938 return 1.0f;
14939
14940 // test pet/charm masters instead pets/charmeds
14941 Unit const* targetOwner = GetOwner();
14942 Unit const* casterOwner = caster->GetOwner();
14943
14944 // Duration of crowd control abilities on pvp target is limited by 10 sec. (2.2.0)
14945 if (limitduration > 0 && duration > limitduration)
14946 {
14947 Unit const* target = targetOwner ? targetOwner : this;
14948 Unit const* source = casterOwner ? casterOwner : caster;
14949
14950 if ((target->GetTypeId() == TYPEID_PLAYER
14952 && source->GetTypeId() == TYPEID_PLAYER)
14953 duration = limitduration;
14954 }
14955
14956 float mod = 1.0f;
14957
14958 if (group == DIMINISHING_TAUNT)
14959 {
14960 if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_OBEYS_TAUNT_DIMINISHING_RETURNS))
14961 {
14962 DiminishingLevels diminish = Level;
14963 switch (diminish)
14964 {
14966 break;
14968 mod = 0.65f;
14969 break;
14971 mod = 0.4225f;
14972 break;
14974 mod = 0.274625f;
14975 break;
14977 mod = 0.0f;
14978 break;
14979 default:
14980 break;
14981 }
14982 }
14983 }
14984 // Some diminishings applies to mobs too (for example, Stun)
14986 && ((targetOwner ? (targetOwner->GetTypeId() == TYPEID_PLAYER) : (GetTypeId() == TYPEID_PLAYER))
14987 || (GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH)))
14989 {
14990 DiminishingLevels diminish = Level;
14991 switch (diminish)
14992 {
14994 break;
14996 mod = 0.5f;
14997 break;
14999 mod = 0.25f;
15000 break;
15002 mod = 0.0f;
15003 break;
15004 default:
15005 break;
15006 }
15007 }
15008
15009 duration = int32(duration * mod);
15010 return mod;
15011}
@ CREATURE_FLAG_EXTRA_OBEYS_TAUNT_DIMINISHING_RETURNS
Definition: CreatureData.h:68
@ CREATURE_FLAG_EXTRA_ALL_DIMINISH
Definition: CreatureData.h:69
DiminishingLevels
Definition: Unit.h:693
@ DIMINISHING_LEVEL_3
Definition: Unit.h:696
@ DIMINISHING_LEVEL_1
Definition: Unit.h:694
@ DIMINISHING_LEVEL_4
Definition: Unit.h:698
@ DIMINISHING_LEVEL_IMMUNE
Definition: Unit.h:697
@ DIMINISHING_LEVEL_TAUNT_IMMUNE
Definition: Unit.h:699
@ DIMINISHING_LEVEL_2
Definition: Unit.h:695
DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group)
Definition: SpellMgr.cpp:246
@ DIMINISHING_NONE
Definition: SharedDefines.h:3230
@ DIMINISHING_TAUNT
Definition: SharedDefines.h:3248
@ DRTYPE_PLAYER
Definition: SharedDefines.h:3223
@ DRTYPE_ALL
Definition: SharedDefines.h:3224
uint32 flags_extra
Definition: CreatureData.h:239

References CREATURE_FLAG_EXTRA_ALL_DIMINISH, CREATURE_FLAG_EXTRA_OBEYS_TAUNT_DIMINISHING_RETURNS, DIMINISHING_LEVEL_1, DIMINISHING_LEVEL_2, DIMINISHING_LEVEL_3, DIMINISHING_LEVEL_4, DIMINISHING_LEVEL_IMMUNE, DIMINISHING_LEVEL_TAUNT_IMMUNE, DIMINISHING_NONE, DIMINISHING_TAUNT, DRTYPE_ALL, DRTYPE_PLAYER, CreatureTemplate::flags_extra, Creature::GetCreatureTemplate(), GetDiminishingReturnsGroupType(), GetOwner(), Object::GetTypeId(), Object::ToCreature(), TYPEID_PLAYER, and TYPEID_UNIT.

Referenced by Spell::DoSpellHitOnUnit().

◆ ApplyEffectModifiers()

float Unit::ApplyEffectModifiers ( SpellInfo const *  spellProto,
uint8  effect_index,
float  value 
) const
14717{
14718 if (Player* modOwner = GetSpellModOwner())
14719 {
14720 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_ALL_EFFECTS, value);
14721 switch (effect_index)
14722 {
14723 case 0:
14724 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT1, value);
14725 break;
14726 case 1:
14727 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT2, value);
14728 break;
14729 case 2:
14730 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT3, value);
14731 break;
14732 }
14733 }
14734 return value;
14735}
@ SPELLMOD_EFFECT2
Definition: SpellDefines.h:89
@ SPELLMOD_ALL_EFFECTS
Definition: SpellDefines.h:85
@ SPELLMOD_EFFECT3
Definition: SpellDefines.h:100
@ SPELLMOD_EFFECT1
Definition: SpellDefines.h:80
Player * GetSpellModOwner() const
Definition: Unit.cpp:16725

References GetSpellModOwner(), SpellInfo::Id, SPELLMOD_ALL_EFFECTS, SPELLMOD_EFFECT1, SPELLMOD_EFFECT2, and SPELLMOD_EFFECT3.

Referenced by spell_mage_ice_barrier_aura::CalculateSpellAmount(), spell_mage_ice_barrier::CalculateSpellAmount(), CalculateSpellAmount(), SpellEffectInfo::CalcValue(), and Spell::EffectSchoolDMG().

◆ ApplyResilience()

void Unit::ApplyResilience ( Unit const *  victim,
float *  crit,
int32 damage,
bool  isCrit,
CombatRating  type 
)
static
19066{
19067 // player mounted on multi-passenger mount is also classified as vehicle
19068 if (victim->IsVehicle() && victim->GetTypeId() != TYPEID_PLAYER)
19069 return;
19070
19071 Unit const* target = nullptr;
19072 if (victim->GetTypeId() == TYPEID_PLAYER)
19073 target = victim;
19074 else if (victim->GetTypeId() == TYPEID_UNIT)
19075 {
19076 if (Unit* owner = victim->GetOwner())
19077 if (owner->GetTypeId() == TYPEID_PLAYER)
19078 target = owner;
19079 }
19080
19081 if (!target)
19082 return;
19083
19084 switch (type)
19085 {
19087 // Crit chance reduction works against nonpets
19088 if (crit)
19089 *crit -= target->GetMeleeCritChanceReduction();
19090 if (damage)
19091 {
19092 if (isCrit)
19093 *damage -= target->GetMeleeCritDamageReduction(*damage);
19094 *damage -= target->GetMeleeDamageReduction(*damage);
19095 }
19096 break;
19098 // Crit chance reduction works against nonpets
19099 if (crit)
19100 *crit -= target->GetRangedCritChanceReduction();
19101 if (damage)
19102 {
19103 if (isCrit)
19104 *damage -= target->GetRangedCritDamageReduction(*damage);
19105 *damage -= target->GetRangedDamageReduction(*damage);
19106 }
19107 break;
19109 // Crit chance reduction works against nonpets
19110 if (crit)
19111 *crit -= target->GetSpellCritChanceReduction();
19112 if (damage)
19113 {
19114 if (isCrit)
19115 *damage -= target->GetSpellCritDamageReduction(*damage);
19116 *damage -= target->GetSpellDamageReduction(*damage);
19117 }
19118 break;
19119 default:
19120 break;
19121 }
19122}
@ CR_CRIT_TAKEN_RANGED
Definition: Unit.h:419
@ CR_CRIT_TAKEN_SPELL
Definition: Unit.h:420
@ CR_CRIT_TAKEN_MELEE
Definition: Unit.h:418
float GetSpellCritChanceReduction() const
Definition: Unit.h:1581
float GetRangedCritChanceReduction() const
Definition: Unit.h:1580
uint32 GetSpellCritDamageReduction(uint32 damage) const
Definition: Unit.h:1586
float GetMeleeCritChanceReduction() const
Definition: Unit.h:1579
uint32 GetRangedDamageReduction(uint32 damage) const
Definition: Unit.h:1590
uint32 GetRangedCritDamageReduction(uint32 damage) const
Definition: Unit.h:1585
uint32 GetMeleeCritDamageReduction(uint32 damage) const
Definition: Unit.h:1584
uint32 GetSpellDamageReduction(uint32 damage) const
Definition: Unit.h:1591
uint32 GetMeleeDamageReduction(uint32 damage) const
Definition: Unit.h:1589

References CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, CR_CRIT_TAKEN_SPELL, GetMeleeCritChanceReduction(), GetMeleeCritDamageReduction(), GetMeleeDamageReduction(), GetOwner(), GetRangedCritChanceReduction(), GetRangedCritDamageReduction(), GetRangedDamageReduction(), GetSpellCritChanceReduction(), GetSpellCritDamageReduction(), GetSpellDamageReduction(), Object::GetTypeId(), IsVehicle(), TYPEID_PLAYER, and TYPEID_UNIT.

Referenced by CalculateSpellDamageTaken(), GetUnitCriticalChance(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), spell_valkyr_touch::spell_valkyr_touchAuraScript::PrepareAuraScript(), and SpellTakenCritChance().

◆ ApplyResistanceBuffModsMod()

void Unit::ApplyResistanceBuffModsMod ( SpellSchools  school,
bool  positive,
float  val,
bool  apply 
)
inline
2027{ ApplyModSignedFloatValue(positive ? static_cast<uint16>(UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE) + school : static_cast<uint16>(UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE) + + school, val, apply); }
@ UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE
Definition: UpdateFields.h:157
@ UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE
Definition: UpdateFields.h:158
void ApplyModSignedFloatValue(uint16 index, float val, bool apply)
Definition: Object.cpp:822

References Object::ApplyModSignedFloatValue(), UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE, and UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE.

Referenced by AuraEffect::HandleAuraModResistance(), and AuraEffect::HandleAuraModResistanceExclusive().

◆ ApplyResistanceBuffModsPercentMod()

void Unit::ApplyResistanceBuffModsPercentMod ( SpellSchools  school,
bool  positive,
float  val,
bool  apply 
)
inline

◆ ApplySpellDispelImmunity()

void Unit::ApplySpellDispelImmunity ( SpellInfo const *  spellProto,
DispelType  type,
bool  apply 
)
13333{
13334 ApplySpellImmune(spellProto->Id, IMMUNITY_DISPEL, type, apply);
13335
13336 if (apply && spellProto->HasAttribute(SPELL_ATTR1_IMMUNITY_PURGES_EFFECT))
13337 {
13338 // Create dispel mask by dispel type
13339 uint32 dispelMask = SpellInfo::GetDispelMask(type);
13340 // Dispel all existing auras vs current dispel type
13342 for (AuraApplicationMap::iterator itr = auras.begin(); itr != auras.end();)
13343 {
13344 SpellInfo const* spell = itr->second->GetBase()->GetSpellInfo();
13345 if (spell->GetDispelMask() & dispelMask)
13346 {
13347 // Dispel aura
13348 RemoveAura(itr);
13349 }
13350 else
13351 ++itr;
13352 }
13353 }
13354}
@ SPELL_ATTR1_IMMUNITY_PURGES_EFFECT
Definition: SharedDefines.h:406
@ IMMUNITY_DISPEL
Definition: SharedDefines.h:1370
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
Definition: Unit.cpp:13305
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition: Unit.h:1299
AuraApplicationMap & GetAppliedAuras()
Definition: Unit.h:1924
uint32 GetDispelMask() const
Definition: SpellInfo.cpp:2026

References ApplySpellImmune(), GetAppliedAuras(), SpellInfo::GetDispelMask(), SpellInfo::HasAttribute(), SpellInfo::Id, IMMUNITY_DISPEL, RemoveAura(), and SPELL_ATTR1_IMMUNITY_PURGES_EFFECT.

Referenced by AuraEffect::HandleAuraModDispelImmunity().

◆ ApplySpellImmune()

void Unit::ApplySpellImmune ( uint32  spellId,
uint32  op,
uint32  type,
bool  apply,
SpellImmuneBlockType  blockType = SPELL_BLOCK_TYPE_ALL 
)
13306{
13307 if (apply)
13308 {
13309 // xinef: immunities with spellId 0 are intended to be applied only once (script purposes mosty)
13310 if (spellId == 0 && std::find_if(m_spellImmune[op].begin(), m_spellImmune[op].end(), spellIdImmunityPredicate(type)) != m_spellImmune[op].end())
13311 return;
13312
13313 SpellImmune immune;
13314 immune.spellId = spellId;
13315 immune.type = type;
13316 immune.blockType = blockType;
13317 m_spellImmune[op].push_back(std::move(immune));
13318 }
13319 else
13320 {
13321 for (SpellImmuneList::iterator itr = m_spellImmune[op].begin(); itr != m_spellImmune[op].end(); ++itr)
13322 {
13323 if (itr->spellId == spellId && itr->type == type)
13324 {
13325 m_spellImmune[op].erase(itr);
13326 break;
13327 }
13328 }
13329 }
13330}
Definition: Unit.cpp:13296
Definition: SpellDefines.h:171
uint32 blockType
Definition: SpellDefines.h:176
uint32 spellId
Definition: SpellDefines.h:174
uint32 type
Definition: SpellDefines.h:175

References SpellImmune::blockType, m_spellImmune, SpellImmune::spellId, and SpellImmune::type.

Referenced by Vehicle::ApplyAllImmunities(), boss_kelidan_the_breaker::boss_kelidan_the_breakerAI::ApplyImmunities(), ApplyMechanicImmune(), ApplySpellDispelImmunity(), boss_amanitar::boss_amanitar(), boss_anubarak_trial::boss_anubarak_trialAI::boss_anubarak_trialAI(), boss_grand_champion::boss_grand_championAI::boss_grand_championAI(), boss_icehowl::boss_icehowlAI::boss_icehowlAI(), boss_sindragosa::boss_sindragosaAI::boss_sindragosaAI(), boss_twin_valkyrAI::boss_twin_valkyrAI(), boss_void_reaver::boss_void_reaverAI::boss_void_reaverAI(), boss_yoggsaron_keeper::boss_yoggsaron_keeperAI::boss_yoggsaron_keeperAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModDmgImmunity(), AuraEffect::HandleAuraModEffectImmunity(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), AuraEffect::HandleAuraModSchoolImmunity(), AuraEffect::HandleAuraModStateImmunity(), Aura::HandleAuraSpecificMods(), spell_q13007_iron_colossus::spell_q13007_iron_colossus_SpellScript::HandleDummy(), spell_love_in_air_perfume_immune::HandleEffectApply(), spell_teron_gorefiend_shadowy_construct::spell_teron_gorefiend_shadowy_construct_AuraScript::HandleEffectApply(), spell_dk_anti_magic_shell_self::HandleEffectApply(), spell_dk_pet_scaling::HandleEffectApply(), spell_dru_treant_scaling::HandleEffectApply(), spell_pet_hit_expertise_scalling::HandleEffectApply(), spell_mage_pet_scaling::HandleEffectApply(), spell_pri_shadowfiend_scaling::HandleEffectApply(), spell_sha_feral_spirit_scaling::HandleEffectApply(), spell_sha_fire_elemental_scaling::HandleEffectApply(), spell_warl_infernal_scaling::HandleEffectApply(), spell_love_in_air_perfume_immune::HandleEffectRemove(), spell_dk_anti_magic_shell_self::HandleEffectRemove(), spell_gen_bg_preparation::HandleEffectRemove(), AuraEffect::HandleModMechanicImmunity(), AuraEffect::HandleModStateImmunityMask(), npc_pet_dk_army_of_the_dead::npc_pet_dk_army_of_the_deadAI::InitializeAI(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::JustSummoned(), boss_hydross_the_unstable::boss_hydross_the_unstableAI::JustSummoned(), boss_alar::boss_alarAI::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), npc_varian_wrynn::npc_varian_wrynnAI::JustSummoned(), Player::LoadFromDB(), Creature::LoadSpellTemplateImmunity(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::MovementInform(), npc_frost_sphere::npc_frost_sphereAI::npc_frost_sphereAI(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::npc_mageguard_dalaranAI(), npc_pos_freed_slave::npc_pos_freed_slaveAI::npc_pos_freed_slaveAI(), npc_target_dummy::npc_target_dummyAI::npc_target_dummyAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::npc_tournament_training_dummyAI(), npc_training_dummy::npc_training_dummyAI::npc_training_dummyAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::npc_ulduar_arachnopod_destroyerAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::npc_valkyr_shadowguardAI(), spell_yogg_saron_malady_of_the_mind::spell_yogg_saron_malady_of_the_mind_AuraScript::OnApply(), instance_violet_hold::instance_violet_hold_InstanceMapScript::OnCreatureCreate(), spell_yogg_saron_malady_of_the_mind::spell_yogg_saron_malady_of_the_mind_AuraScript::OnRemove(), boss_flame_leviathan_seat::boss_flame_leviathan_seatAI::PassengerBoarded(), npc_hover_disk::npc_hover_diskAI::PassengerBoarded(), boss_curator::boss_curatorAI::Reset(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::Reset(), npc_varian_wrynn::npc_varian_wrynnAI::Reset(), npc_jaina_proudmoore_bfu::npc_jaina_proudmoore_bfuAI::Reset(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::Reset(), npc_dark_iron_guzzler::Reset(), boss_archimonde::boss_archimondeAI::Reset(), boss_mal_ganis::boss_mal_ganisAI::Reset(), boss_tharon_ja::boss_tharon_jaAI::Reset(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::Reset(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::Reset(), boss_gluth::boss_gluthAI::Reset(), boss_urom::boss_uromAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_ionar::boss_ionarAI::Reset(), boss_auriaya::boss_auriayaAI::Reset(), boss_flame_leviathan::boss_flame_leviathanAI::Reset(), boss_alar::boss_alarAI::Reset(), boss_kaelthas::boss_kaelthasAI::Reset(), npc_ragin_flames::npc_ragin_flamesAI::Reset(), boss_supremus::boss_supremusAI::SchedulePhase(), boss_hydross_the_unstable::boss_hydross_the_unstableAI::SetForm(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::SummonChannelers(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::UpdateAI(), boss_auriaya::boss_auriayaAI::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), Creature::UpdateEntry(), and npc_koltira_deathweaver::npc_koltira_deathweaverAI::WaypointReached().

◆ ApplyStatBuffMod()

void Unit::ApplyStatBuffMod ( Stats  stat,
float  val,
bool  apply 
)
inline
2034{ ApplyModSignedFloatValue((val > 0 ? static_cast<uint16>(UNIT_FIELD_POSSTAT0) + stat : static_cast<uint16>(UNIT_FIELD_NEGSTAT0) + stat), val, apply); }
@ UNIT_FIELD_POSSTAT0
Definition: UpdateFields.h:146
@ UNIT_FIELD_NEGSTAT0
Definition: UpdateFields.h:151

References Object::ApplyModSignedFloatValue(), UNIT_FIELD_NEGSTAT0, and UNIT_FIELD_POSSTAT0.

Referenced by Player::_ApplyItemBonuses(), Player::ApplyEnchantment(), and AuraEffect::HandleAuraModStat().

◆ ApplyStatPercentBuffMod()

void Unit::ApplyStatPercentBuffMod ( Stats  stat,
float  val,
bool  apply 
)
15225{
15226 if (val == -100.0f) // prevent set var to zero
15227 val = -99.99f;
15228 float var = GetStat(stat) * val / 100.0f;
15229 ApplyModSignedFloatValue((var > 0 ? static_cast<uint16>(UNIT_FIELD_POSSTAT0) + stat : static_cast<uint16>(UNIT_FIELD_NEGSTAT0) + stat), var, apply);
15230}
float GetStat(Stats stat) const
Definition: Unit.h:1430

References Object::ApplyModSignedFloatValue(), GetStat(), UNIT_FIELD_NEGSTAT0, and UNIT_FIELD_POSSTAT0.

Referenced by AuraEffect::HandleModTotalPercentStat().

◆ ApplyTotalThreatModifier()

float Unit::ApplyTotalThreatModifier ( float  fThreat,
SpellSchoolMask  schoolMask = SPELL_SCHOOL_MASK_NORMAL 
)
14532{
14533 if (!HasAuraType(SPELL_AURA_MOD_THREAT) || fThreat < 0)
14534 return fThreat;
14535
14536 SpellSchools school = GetFirstSchoolInMask(schoolMask);
14537
14538 return fThreat * m_threatModifier[school];
14539}
@ SPELL_AURA_MOD_THREAT
Definition: SpellAuraDefines.h:73
SpellSchools
Definition: SharedDefines.h:254
SpellSchools GetFirstSchoolInMask(SpellSchoolMask mask)
Definition: SharedDefines.h:290
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:5617

References GetFirstSchoolInMask(), HasAuraType(), m_threatModifier, and SPELL_AURA_MOD_THREAT.

Referenced by ThreatCalcHelper::calcThreat().

◆ Attack()

bool Unit::Attack ( Unit victim,
bool  meleeAttack 
)
10246{
10247 if (!victim || victim == this)
10248 return false;
10249
10250 // dead units can neither attack nor be attacked
10251 if (!IsAlive() || !victim->IsAlive())
10252 return false;
10253
10254 // pussywizard: check map, world, phase >_> multithreading crash fix
10255 if (!IsInMap(victim) || !InSamePhase(victim))
10256 return false;
10257
10258 // player cannot attack in mount state
10259 if (GetTypeId() == TYPEID_PLAYER && IsMounted())
10260 return false;
10261
10262 // creatures cannot attack while evading
10263 Creature* creature = ToCreature();
10264 if (creature && creature->IsInEvadeMode())
10265 {
10266 return false;
10267 }
10268
10269 // creatures should not try to attack the player during polymorph
10270 if (creature && creature->IsPolymorphed())
10271 {
10272 return false;
10273 }
10274
10275 //if (HasUnitFlag(UNIT_FLAG_PACIFIED)) // pussywizard: why having this flag prevents from entering combat? it should just prevent melee attack
10276 // return false;
10277
10278 // nobody can attack GM in GM-mode
10279 if (victim->GetTypeId() == TYPEID_PLAYER)
10280 {
10281 if (victim->ToPlayer()->IsGameMaster())
10282 return false;
10283 }
10284 else
10285 {
10286 if (victim->ToCreature()->IsEvadingAttacks())
10287 return false;
10288 }
10289
10290 // Unit with SPELL_AURA_SPIRIT_OF_REDEMPTION can not attack
10292 return false;
10293
10294 // remove SPELL_AURA_MOD_UNATTACKABLE at attack (in case non-interruptible spells stun aura applied also that not let attack)
10297
10298 if (m_attacking)
10299 {
10300 if (m_attacking == victim)
10301 {
10302 // switch to melee attack from ranged/magic
10303 if (meleeAttack)
10304 {
10306 {
10308 SendMeleeAttackStart(victim);
10309 return true;
10310 }
10311 }
10313 {
10315 SendMeleeAttackStop(victim);
10316 return true;
10317 }
10318 return false;
10319 }
10320
10321 // switch target
10322 InterruptSpell(CURRENT_MELEE_SPELL, true, true, true);
10323 if (!meleeAttack)
10325 }
10326
10327 if (m_attacking)
10329
10330 m_attacking = victim;
10332
10333 // Set our target
10334 SetTarget(victim->GetGUID());
10335
10336 if (meleeAttack)
10338
10339 // set position before any AI calls/assistance
10340 //if (GetTypeId() == TYPEID_UNIT)
10341 // ToCreature()->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
10342 if (creature && !(IsControllableGuardian() && IsControlledByPlayer()))
10343 {
10344 // should not let player enter combat by right clicking target - doesn't helps
10345 SetInCombatWith(victim);
10346 if (victim->GetTypeId() == TYPEID_PLAYER)
10347 victim->SetInCombatWith(this);
10348 AddThreat(victim, 0.0f);
10349
10351
10352 creature->CallAssistance();
10354
10356 }
10357
10358 // delay offhand weapon attack to next attack time
10361
10362 if (meleeAttack)
10363 SendMeleeAttackStart(victim);
10364
10365 return true;
10366}
@ UNIT_NPC_EMOTESTATE
Definition: UpdateFields.h:140
#define ATTACK_DISPLAY_DELAY
Definition: Unit.h:1238
@ CURRENT_MELEE_SPELL
Definition: Unit.h:978
@ UNIT_STATE_MELEE_ATTACKING
Definition: Unit.h:326
@ SPELL_AURA_SPIRIT_OF_REDEMPTION
Definition: SpellAuraDefines.h:239
@ SPELL_AURA_MOD_UNATTACKABLE
Definition: SpellAuraDefines.h:156
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_PERIOD
Definition: IWorld.h:279
@ EMOTE_ONESHOT_NONE
Definition: SharedDefines.h:1866
@ AI_REACTION_HOSTILE
Definition: SharedDefines.h:3214
#define sWorld
Definition: World.h:458
void CallAssistance(Unit *target=nullptr)
Definition: Creature.cpp:2348
bool IsEvadingAttacks() const
Definition: Creature.h:130
void SetAssistanceTimer(uint32 value)
Definition: Creature.h:383
void SendAIReaction(AiReaction reactionType)
Definition: Creature.cpp:2336
bool IsInEvadeMode() const
Definition: Creature.h:129
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:650
bool InSamePhase(WorldObject const *obj) const
Definition: Object.h:435
bool IsInMap(WorldObject const *obj) const
Definition: Object.cpp:1285
bool IsGameMaster() const
Definition: Player.h:1136
void ClearUnitState(uint32 f)
Definition: Unit.h:1399
bool IsPolymorphed() const
Definition: Unit.cpp:16889
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition: Unit.cpp:14543
void _removeAttacker(Unit *pAttacker)
Definition: Unit.h:1362
bool haveOffhandWeapon() const
Definition: Unit.cpp:540
void _addAttacker(Unit *pAttacker)
Definition: Unit.h:1358
void SetInCombatWith(Unit *enemy, uint32 duration=0)
Definition: Unit.cpp:13497
bool IsMounted() const
Definition: Unit.h:1542
void SendMeleeAttackStart(Unit *victim, Player *sendTo=nullptr)
Definition: Unit.cpp:3023
bool IsControllableGuardian() const
Definition: Unit.h:1412
void SendMeleeAttackStop(Unit *victim=nullptr)
Definition: Unit.cpp:3035
bool IsControlledByPlayer() const
Definition: Unit.h:1828
virtual void SetTarget(ObjectGuid=ObjectGuid::Empty)=0

References _addAttacker(), _removeAttacker(), AddThreat(), AddUnitState(), AI_REACTION_HOSTILE, ATTACK_DISPLAY_DELAY, Creature::CallAssistance(), ClearUnitState(), CONFIG_CREATURE_FAMILY_ASSISTANCE_PERIOD, CURRENT_MELEE_SPELL, EMOTE_ONESHOT_NONE, Object::GetGUID(), Object::GetTypeId(), HasAuraType(), HasUnitState(), haveOffhandWeapon(), WorldObject::InSamePhase(), InterruptSpell(), IsAlive(), isAttackReady(), IsControllableGuardian(), IsControlledByPlayer(), Creature::IsEvadingAttacks(), Player::IsGameMaster(), Creature::IsInEvadeMode(), WorldObject::IsInMap(), IsMounted(), IsPolymorphed(), m_attacking, OFF_ATTACK, RemoveAurasByType(), Creature::SendAIReaction(), SendMeleeAttackStart(), SendMeleeAttackStop(), Creature::SetAssistanceTimer(), setAttackTimer(), SetInCombatWith(), SetTarget(), Object::SetUInt32Value(), SPELL_AURA_MOD_UNATTACKABLE, SPELL_AURA_SPIRIT_OF_REDEMPTION, sWorld, Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, UNIT_NPC_EMOTESTATE, and UNIT_STATE_MELEE_ATTACKING.

Referenced by UnitAI::AttackStart(), FollowerAI::AttackStart(), PossessedAI::AttackStart(), boss_ragnaros::boss_ragnarosAI::AttackStart(), npc_gunship_mage::npc_gunship_mageAI::AttackStart(), npc_gunship_gunner::npc_gunship_gunnerAI::AttackStart(), boss_priestess_lackey_commonAI::AttackStart(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::AttackStart(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::AttackStart(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::AttackStart(), boss_malygos::boss_malygosAI::AttackStart(), npc_nexus_lord::npc_nexus_lordAI::AttackStart(), boss_illidan_stormrage::boss_illidan_stormrageAI::AttackStart(), ArcherAI::AttackStart(), TurretAI::AttackStart(), npc_escortAI::AttackStart(), SmartAI::AttackStart(), npc_daphne_stilwell::npc_daphne_stilwellAI::AttackStart(), boss_alyson_antille::boss_alyson_antilleAI::AttackStart(), boss_gazakrothAI::AttackStart(), boss_slither::boss_slitherAI::AttackStart(), npc_zelfrax::npc_zelfraxAI::AttackStart(), boss_jormungarAI::AttackStart(), boss_four_horsemen::boss_four_horsemenAI::AttackStart(), boss_magus_telestra::boss_magus_telestraAI::AttackStart(), boss_kologarn::boss_kologarnAI::AttackStart(), boss_mimiron::boss_mimironAI::AttackStart(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::AttackStart(), boss_razorscale::boss_razorscaleAI::AttackStart(), boss_high_nethermancer_zerevor::boss_high_nethermancer_zerevorAI::AttackStart(), boss_lady_malande::boss_lady_malandeAI::AttackStart(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::AttackStart(), boss_the_lurker_below::boss_the_lurker_belowAI::AttackStart(), boss_olm_the_summoner::boss_olm_the_summonerAI::AttackStart(), boss_krosh_firehand::boss_krosh_firehandAI::AttackStart(), boss_nazan::boss_nazanAI::AttackStart(), boss_grand_warlock_nethekurse::boss_grand_warlock_nethekurseAI::AttackStart(), npc_millhouse_manastorm::npc_millhouse_manastormAI::AttackStart(), boss_high_astromancer_solarian::boss_high_astromancer_solarianAI::AttackStart(), npc_pet_gen_gnomish_flame_turret::AttackStart(), UnitAI::AttackStartCaster(), ScriptedAI::AttackStartNoMove(), PetAI::DoAttack(), boss_halazzi::boss_halazziAI::EnterPhase(), WorldSession::HandleAttackSwingOpcode(), spell_q12096_q12092_dummy::spell_q12096_q12092_dummy_SpellScript::HandleDummy(), WorldSession::HandlePetActionHelper(), npc_necromancer::npc_necromancerAI::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustSummoned(), RemoveCharmedBy(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), npc_gargoyle::npc_gargoyleAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), Player::UpdateCharmedAI(), and npc_ranger_lilatha::WaypointReached().

◆ AttackerStateUpdate()

void Unit::AttackerStateUpdate ( Unit victim,
WeaponAttackType  attType = BASE_ATTACK,
bool  extra = false,
bool  ignoreCasting = false 
)
2528{
2530 {
2531 return;
2532 }
2533
2534 if (HasUnitState(UNIT_STATE_CANNOT_AUTOATTACK) && !extra && !ignoreCasting)
2535 {
2536 return;
2537 }
2538
2539 if (!victim->IsAlive())
2540 return;
2541
2542 if ((attType == BASE_ATTACK || attType == OFF_ATTACK) && !IsWithinLOSInMap(victim))
2543 return;
2544
2545 // CombatStart puts the target into stand state, so we need to cache sit state here to know if we should crit later
2546 const bool sittingVictim = victim->GetTypeId() == TYPEID_PLAYER && (victim->IsSitState() || victim->getStandState() == UNIT_STAND_STATE_SLEEP);
2547
2548 CombatStart(victim);
2550
2551 if (attType != BASE_ATTACK && attType != OFF_ATTACK)
2552 return; // ignore ranged case
2553
2554 if (!extra && _lastExtraAttackSpell)
2555 {
2557 }
2558
2559 bool meleeAttack = true;
2560
2561 // melee attack spell casted at main hand attack only - no normal melee dmg dealt
2562 if (attType == BASE_ATTACK && m_currentSpells[CURRENT_MELEE_SPELL] && !extra)
2563 {
2564 meleeAttack = false; // The melee attack is replaced by the melee spell
2565
2567 SpellCastResult castResult = meleeSpell->CheckCast(false);
2568 if (castResult != SPELL_CAST_OK)
2569 {
2570 meleeSpell->SendCastResult(castResult);
2571 meleeSpell->SendInterrupted(0);
2572
2573 meleeSpell->finish(false);
2574 meleeSpell->SetExecutedCurrently(false);
2575
2576 if (castResult == SPELL_FAILED_NO_POWER)
2577 {
2578 // Not enough rage, do a regular melee attack instead
2579 meleeAttack = true;
2580 }
2581 }
2582 else
2583 {
2584 meleeSpell->cast(true);
2585 }
2586 }
2587 if (meleeAttack)
2588 {
2589 // attack can be redirected to another target
2590 victim = GetMeleeHitRedirectTarget(victim);
2591 CalcDamageInfo damageInfo;
2592 CalculateMeleeDamage(victim, &damageInfo, attType, sittingVictim);
2593
2594 // Send log damage message to client
2595 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
2596 {
2597 Unit::DealDamageMods(victim, damageInfo.damages[i].damage, &damageInfo.damages[i].absorb);
2598 }
2599
2600 SendAttackStateUpdate(&damageInfo);
2601
2602 //TriggerAurasProcOnEvent(damageInfo);
2603
2604 _lastDamagedTargetGuid = victim->GetGUID();
2605
2606 DealMeleeDamage(&damageInfo, true);
2607
2608 DamageInfo dmgInfo(damageInfo);
2609 Unit::ProcDamageAndSpell(damageInfo.attacker, damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, damageInfo.procEx, dmgInfo.GetDamage(),
2610 damageInfo.attackType, nullptr, nullptr, -1, nullptr, &dmgInfo);
2611
2612 if (GetTypeId() == TYPEID_PLAYER)
2613 LOG_DEBUG("entities.unit", "AttackerStateUpdate: (Player) {} attacked {} for {} dmg, absorbed {}, blocked {}, resisted {}.",
2614 GetGUID().ToString(), victim->GetGUID().ToString(), dmgInfo.GetDamage(), dmgInfo.GetAbsorb(), dmgInfo.GetBlock(), dmgInfo.GetResist());
2615 else
2616 LOG_DEBUG("entities.unit", "AttackerStateUpdate: (NPC) {} attacked {} for {} dmg, absorbed {}, blocked {}, resisted {}.",
2617 GetGUID().ToString(), victim->GetGUID().ToString(), dmgInfo.GetDamage(), dmgInfo.GetAbsorb(), dmgInfo.GetBlock(), dmgInfo.GetResist());
2618
2619 // Let the pet know we've started attacking someting. Handles melee attacks only
2620 // Spells such as auto-shot and others handled in WorldSession::HandleCastSpellOpcode
2621 if (GetTypeId() == TYPEID_PLAYER && !m_Controlled.empty())
2622 for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
2623 if (Unit* pet = *itr)
2624 if (pet->IsAlive() && pet->GetTypeId() == TYPEID_UNIT)
2625 pet->ToCreature()->AI()->OwnerAttacked(victim);
2626 }
2627}
#define MAX_ITEM_PROTO_DAMAGES
Definition: ItemTemplate.h:622
@ UNIT_STAND_STATE_SLEEP
Definition: Unit.h:56
@ UNIT_STATE_CANNOT_AUTOATTACK
Definition: Unit.h:368
@ UNIT_FLAG_PACIFIED
Definition: Unit.h:465
@ AURA_INTERRUPT_FLAG_MELEE_ATTACK
Definition: SpellDefines.h:56
@ SPELL_FAILED_NO_POWER
Definition: SharedDefines.h:1006
bool IsWithinLOSInMap(WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
Definition: Object.cpp:1347
std::string ToString() const
Definition: ObjectGuid.cpp:47
std::string ToString() const
Definition: Position.cpp:51
Definition: Unit.h:761
Definition: Unit.h:882
uint32 procAttacker
Definition: Unit.h:899
uint32 procVictim
Definition: Unit.h:900
uint32 absorb
Definition: Unit.h:890
struct CalcDamageInfo::@248 damages[MAX_ITEM_PROTO_DAMAGES]
uint32 damage
Definition: Unit.h:889
uint32 procEx
Definition: Unit.h:901
Unit * attacker
Definition: Unit.h:883
Unit * target
Definition: Unit.h:884
WeaponAttackType attackType
Definition: Unit.h:898
void SendAttackStateUpdate(CalcDamageInfo *damageInfo)
Definition: Unit.cpp:6391
void CombatStart(Unit *target, bool initialAggro=true)
Definition: Unit.cpp:13541
Unit * GetMeleeHitRedirectTarget(Unit *victim, SpellInfo const *spellInfo=nullptr)
Definition: Unit.cpp:11017
void CalculateMeleeDamage(Unit *victim, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK, const bool sittingVictim=false)
Definition: Unit.cpp:1461
static void ProcDamageAndSpell(Unit *actor, Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellInfo const *procSpellInfo=nullptr, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
Definition: Unit.cpp:6290
uint8 getStandState() const
Definition: Unit.h:1534
void DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
Definition: Unit.cpp:1821
static void DealDamageMods(Unit const *victim, uint32 &damage, uint32 *absorb)
Definition: Unit.cpp:805
void cast(bool skipCheck=false)
Definition: Spell.cpp:3765
void SetExecutedCurrently(bool yes)
Definition: Spell.h:560
void SendInterrupted(uint8 result)
Definition: Spell.cpp:5136
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, uint8 castCount, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE)
Definition: Spell.cpp:4631
void finish(bool ok=true)
Definition: Spell.cpp:4449

References _lastDamagedTargetGuid, _lastExtraAttackSpell, CalcDamageInfo::absorb, CalcDamageInfo::attacker, CalcDamageInfo::attackType, AURA_INTERRUPT_FLAG_MELEE_ATTACK, BASE_ATTACK, CalculateMeleeDamage(), Spell::cast(), Spell::CheckCast(), CombatStart(), CURRENT_MELEE_SPELL, CalcDamageInfo::damage, CalcDamageInfo::damages, DealDamageMods(), DealMeleeDamage(), Spell::finish(), DamageInfo::GetAbsorb(), DamageInfo::GetBlock(), DamageInfo::GetDamage(), Object::GetGUID(), GetMeleeHitRedirectTarget(), DamageInfo::GetResist(), getStandState(), Object::GetTypeId(), HasUnitFlag(), HasUnitState(), IsAlive(), IsSitState(), WorldObject::IsWithinLOSInMap(), LOG_DEBUG, m_Controlled, m_currentSpells, MAX_ITEM_PROTO_DAMAGES, OFF_ATTACK, CalcDamageInfo::procAttacker, ProcDamageAndSpell(), CalcDamageInfo::procEx, CalcDamageInfo::procVictim, RemoveAurasWithInterruptFlags(), SendAttackStateUpdate(), Spell::SendCastResult(), Spell::SendInterrupted(), Spell::SetExecutedCurrently(), SPELL_CAST_OK, SPELL_FAILED_NO_POWER, CalcDamageInfo::target, ObjectGuid::ToString(), Position::ToString(), TYPEID_PLAYER, TYPEID_UNIT, UNIT_FLAG_PACIFIED, UNIT_STAND_STATE_SLEEP, and UNIT_STATE_CANNOT_AUTOATTACK.

Referenced by UnitAI::DoMeleeAttackIfReady(), boss_zuljin::boss_zuljinAI::DoMeleeAttackIfReady(), boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), HandleProcExtraAttackFor(), boss_twin_valkyrAI::myDoMeleeAttackIfReady(), npc_daphne_stilwell::npc_daphne_stilwellAI::Update(), Player::Update(), boss_dred::boss_dredAI::UpdateAI(), boss_kologarn::boss_kologarnAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), boss_the_lurker_below::boss_the_lurker_belowAI::UpdateAI(), boss_alar::boss_alarAI::UpdateAI(), and generic_creature::generic_creatureAI::UpdateAI().

◆ AttackStop()

bool Unit::AttackStop ( )
10369{
10370 if (!m_attacking)
10371 return false;
10372
10373 Unit* victim = m_attacking;
10374
10376 m_attacking = nullptr;
10377
10378 // Clear our target
10380
10382
10384
10385 // reset only at real combat stop
10386 if (Creature* creature = ToCreature())
10387 {
10388 creature->SetNoCallAssistance(false);
10389
10390 if (creature->HasSearchedAssistance())
10391 {
10392 creature->SetNoSearchAssistance(false);
10393 }
10394 }
10395
10396 SendMeleeAttackStop(victim);
10397
10398 return true;
10399}

References _removeAttacker(), ClearUnitState(), CURRENT_MELEE_SPELL, ObjectGuid::Empty, InterruptSpell(), m_attacking, SendMeleeAttackStop(), SetTarget(), Object::ToCreature(), and UNIT_STATE_MELEE_ATTACKING.

Referenced by PetAI::_stopAttack(), boss_professor_putricide::boss_professor_putricideAI::ChangePhase(), CombatStop(), boss_thekal::boss_thekalAI::DamageTaken(), boss_jedoga_shadowseeker::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), boss_algalon_the_observer::boss_algalon_the_observerAI::DamageTaken(), boss_freya::boss_freyaAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), boss_viscidus::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), adyen_the_lightbringer::adyen_the_lightbringerAI::DoAction(), anchorite_karja::anchorite_karjaAI::DoAction(), exarch_orelis::exarch_orelisAI::DoAction(), ScriptedAI::DoStopAttack(), Player::DuelComplete(), Spell::EffectSanctuary(), SmartAI::EnterEvadeMode(), Spell::finish(), WorldSession::HandleAttackStopOpcode(), spell_hun_scatter_shot::HandleDummy(), spell_mc_play_dead::spell_mc_play_dead_AuraScript::HandleEffectApply(), AuraEffect::HandleFeignDeath(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePetStopAttack(), RotateMovementGenerator::Initialize(), PetAI::KilledUnit(), MotionMaster::MoveSeekAssistance(), spell_halion_twilight_phasing::spell_halion_twilight_phasing_AuraScript::OnApply(), spell_halion_twilight_phasing::spell_halion_twilight_phasing_AuraScript::OnRemove(), PetSpellFail(), RemoveCharmedBy(), npc_putricide_oozeAI::SelectNewTarget(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), SetCharmedBy(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), boss_noth::boss_nothAI::StartBalconyPhase(), boss_heigan::boss_heiganAI::StartFightPhase(), boss_lord_valthalak::boss_lord_valthalakAI::StartTalking(), StopAttackFaction(), StopAttackingInvalidTarget(), boss_ouro::Submerge(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_janalai::boss_janalaiAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_onyxia::UpdateAI(), npc_qiraj_war_spawn::npc_qiraj_war_spawnAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), PossessedAI::UpdateAI(), Player::UpdateFFAPvPFlag(), and Player::UpdateFFAPvPState().

◆ BuildAuraStateUpdateForTarget()

uint32 Unit::BuildAuraStateUpdateForTarget ( Unit target) const
10497{
10499 for (AuraStateAurasMap::const_iterator itr = m_auraStateAuras.begin(); itr != m_auraStateAuras.end(); ++itr)
10500 if ((1 << (itr->first - 1)) & PER_CASTER_AURA_STATE_MASK)
10501 if (itr->second->GetBase()->GetCasterGUID() == target->GetGUID())
10502 auraStates |= (1 << (itr->first - 1));
10503
10504 return auraStates;
10505}
@ UNIT_FIELD_AURASTATE
Definition: UpdateFields.h:119
#define PER_CASTER_AURA_STATE_MASK
Definition: SharedDefines.h:1290
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:305

References Object::GetGUID(), Object::GetUInt32Value(), m_auraStateAuras, PER_CASTER_AURA_STATE_MASK, and UNIT_FIELD_AURASTATE.

Referenced by BuildValuesUpdate().

◆ BuildCooldownPacket() [1/2]

void Unit::BuildCooldownPacket ( WorldPacket data,
uint8  flags,
PacketCooldowns const &  cooldowns 
)
21132{
21133 data.Initialize(SMSG_SPELL_COOLDOWN, 8 + 1 + (4 + 4) * cooldowns.size());
21134 data << GetGUID();
21135 data << uint8(flags);
21136 for (std::unordered_map<uint32, uint32>::const_iterator itr = cooldowns.begin(); itr != cooldowns.end(); ++itr)
21137 {
21138 data << uint32(itr->first);
21139 data << uint32(itr->second);
21140 }
21141}
@ SMSG_SPELL_COOLDOWN
Definition: Opcodes.h:338
void Initialize(uint16 opcode, size_t newres=200)
Definition: WorldPacket.h:69

References Object::GetGUID(), WorldPacket::Initialize(), and SMSG_SPELL_COOLDOWN.

◆ BuildCooldownPacket() [2/2]

void Unit::BuildCooldownPacket ( WorldPacket data,
uint8  flags,
uint32  spellId,
uint32  cooldown 
)

◆ BuildHeartBeatMsg()

void Unit::BuildHeartBeatMsg ( WorldPacket data) const
2049{
2050 data->Initialize(MSG_MOVE_HEARTBEAT, 32);
2051 *data << GetPackGUID();
2052 BuildMovementPacket(data);
2053}
@ MSG_MOVE_HEARTBEAT
Definition: Opcodes.h:268
void BuildMovementPacket(ByteBuffer *data) const
Definition: Unit.cpp:20027

References BuildMovementPacket(), Object::GetPackGUID(), WorldPacket::Initialize(), and MSG_MOVE_HEARTBEAT.

Referenced by boss_volkhan::boss_volkhanAI::MovementInform(), and SendMovementFlagUpdate().

◆ BuildMovementPacket()

void Unit::BuildMovementPacket ( ByteBuffer data) const
20028{
20029 *data << uint32(GetUnitMovementFlags()); // movement flags
20030 *data << uint16(GetExtraUnitMovementFlags()); // 2.3.0
20031 *data << uint32(GameTime::GetGameTimeMS().count()); // time / counter
20032 *data << GetPositionX();
20033 *data << GetPositionY();
20034 *data << GetPositionZ();
20035 *data << GetOrientation();
20036
20037 // 0x00000200
20039 {
20040 if (m_vehicle)
20041 *data << m_vehicle->GetBase()->GetPackGUID();
20042 else if (GetTransport())
20043 *data << GetTransport()->GetPackGUID();
20044 else
20045 *data << (uint8)0;
20046
20047 *data << float (GetTransOffsetX());
20048 *data << float (GetTransOffsetY());
20049 *data << float (GetTransOffsetZ());
20050 *data << float (GetTransOffsetO());
20051 *data << uint32(GetTransTime());
20052 *data << uint8 (GetTransSeat());
20053
20056 }
20057
20058 // 0x02200000
20061 *data << (float)m_movementInfo.pitch;
20062
20063 *data << (uint32)m_movementInfo.fallTime;
20064
20065 // 0x00001000
20067 {
20068 *data << (float)m_movementInfo.jump.zspeed;
20069 *data << (float)m_movementInfo.jump.sinAngle;
20070 *data << (float)m_movementInfo.jump.cosAngle;
20071 *data << (float)m_movementInfo.jump.xyspeed;
20072 }
20073
20074 // 0x04000000
20076 *data << (float)m_movementInfo.splineElevation;
20077}
@ MOVEMENTFLAG_ONTRANSPORT
Definition: Unit.h:561
@ MOVEMENTFLAG_FLYING
Definition: Unit.h:577
@ MOVEMENTFLAG_FALLING
Definition: Unit.h:564
@ MOVEMENTFLAG_SWIMMING
Definition: Unit.h:573
@ MOVEMENTFLAG_SPLINE_ELEVATION
Definition: Unit.h:578
@ MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING
Definition: Unit.h:613
@ MOVEMENTFLAG2_INTERPOLATED_MOVEMENT
Definition: Unit.h:618
struct MovementInfo::JumpInfo jump
uint32 fallTime
Definition: Object.h:295
struct MovementInfo::TransportInfo transport
float splineElevation
Definition: Object.h:309
float pitch
Definition: Object.h:292
uint32 time2
Definition: Object.h:288
float cosAngle
Definition: Object.h:305
float xyspeed
Definition: Object.h:305
float zspeed
Definition: Object.h:305
float sinAngle
Definition: Object.h:305
float GetTransOffsetX() const
Definition: Object.h:586
float GetTransOffsetY() const
Definition: Object.h:587
float GetTransOffsetZ() const
Definition: Object.h:588
uint32 GetTransTime() const
Definition: Object.h:590
Transport * GetTransport() const
Definition: Object.h:585
float GetTransOffsetO() const
Definition: Object.h:589
uint32 GetUnitMovementFlags() const
Definition: Unit.h:2275
uint16 GetExtraUnitMovementFlags() const
Definition: Unit.h:2281

References MovementInfo::JumpInfo::cosAngle, MovementInfo::fallTime, MovementInfo::flags2, Vehicle::GetBase(), GetExtraUnitMovementFlags(), GameTime::GetGameTimeMS(), Position::GetOrientation(), Object::GetPackGUID(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::GetTransOffsetO(), WorldObject::GetTransOffsetX(), WorldObject::GetTransOffsetY(), WorldObject::GetTransOffsetZ(), WorldObject::GetTransport(), WorldObject::GetTransSeat(), WorldObject::GetTransTime(), GetUnitMovementFlags(), MovementInfo::jump, WorldObject::m_movementInfo, m_vehicle, MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING, MOVEMENTFLAG2_INTERPOLATED_MOVEMENT, MOVEMENTFLAG_FALLING, MOVEMENTFLAG_FLYING, MOVEMENTFLAG_ONTRANSPORT, MOVEMENTFLAG_SPLINE_ELEVATION, MOVEMENTFLAG_SWIMMING, MovementInfo::pitch, MovementInfo::JumpInfo::sinAngle, MovementInfo::splineElevation, MovementInfo::TransportInfo::time2, MovementInfo::transport, MovementInfo::JumpInfo::xyspeed, and MovementInfo::JumpInfo::zspeed.

Referenced by BuildHeartBeatMsg(), Object::BuildMovementUpdate(), WorldSession::HandleMoveKnockBackAck(), Player::SendTeleportAckPacket(), SendTeleportPacket(), Player::SetCanFly(), Creature::SetCanFly(), Creature::SetDisableGravity(), Player::SetDisableGravity(), Player::SetFeatherFall(), Creature::SetFeatherFall(), Player::SetHover(), SetSpeed(), Player::SetWaterWalking(), and Creature::SetWaterWalking().

◆ BuildValuesUpdate()

void Unit::BuildValuesUpdate ( uint8  updatetype,
ByteBuffer data,
Player target 
) const
overrideprotectedvirtual

Reimplemented from Object.

20914{
20915 if (!target)
20916 return;
20917
20918 ByteBuffer fieldBuffer;
20919
20920 UpdateMask updateMask;
20921 updateMask.SetCount(m_valuesCount);
20922
20924 uint32 visibleFlag = UF_FLAG_PUBLIC;
20925
20926 if (target == this)
20927 visibleFlag |= UF_FLAG_PRIVATE;
20928
20930 if (GetOwnerGUID() == target->GetGUID())
20931 visibleFlag |= UF_FLAG_OWNER;
20932
20935 visibleFlag |= UF_FLAG_SPECIAL_INFO;
20936
20937 if (plr && plr->IsInSameRaidWith(target))
20938 visibleFlag |= UF_FLAG_PARTY_MEMBER;
20939
20940 Creature const* creature = ToCreature();
20941 for (uint16 index = 0; index < m_valuesCount; ++index)
20942 {
20943 if (_fieldNotifyFlags & flags[index] ||
20944 ((flags[index] & visibleFlag) & UF_FLAG_SPECIAL_INFO) ||
20945 ((updateType == UPDATETYPE_VALUES ? _changesMask.GetBit(index) : m_uint32Values[index]) && (flags[index] & visibleFlag)) ||
20947 {
20948 updateMask.SetBit(index);
20949
20950 if (index == UNIT_NPC_FLAGS)
20951 {
20952 uint32 appendValue = m_uint32Values[UNIT_NPC_FLAGS];
20953
20954 if (creature)
20955 {
20956 if (sWorld->getIntConfig(CONFIG_INSTANT_TAXI) == 2 && appendValue & UNIT_NPC_FLAG_FLIGHTMASTER)
20957 {
20958 appendValue |= UNIT_NPC_FLAG_GOSSIP; // flight masters need NPC gossip flag to show instant flight toggle option
20959 }
20960
20961 if (!target->CanSeeSpellClickOn(creature))
20962 {
20963 appendValue &= ~UNIT_NPC_FLAG_SPELLCLICK;
20964 }
20965
20966 if (!target->CanSeeVendor(creature))
20967 {
20968 appendValue &= ~UNIT_NPC_FLAG_VENDOR_MASK;
20969 }
20970
20971 if (!creature->IsValidTrainerForPlayer(target, &appendValue))
20972 {
20973 appendValue &= ~UNIT_NPC_FLAG_TRAINER;
20974 }
20975 }
20976
20977 fieldBuffer << uint32(appendValue);
20978 }
20979 else if (index == UNIT_FIELD_AURASTATE)
20980 {
20981 // Check per caster aura states to not enable using a spell in client if specified aura is not by target
20982 fieldBuffer << BuildAuraStateUpdateForTarget(target);
20983 }
20984 // FIXME: Some values at server stored in float format but must be sent to client in uint32 format
20985 else if (index >= UNIT_FIELD_BASEATTACKTIME && index <= UNIT_FIELD_RANGEDATTACKTIME)
20986 {
20987 // convert from float to uint32 and send
20988 fieldBuffer << uint32(m_floatValues[index] < 0 ? 0 : m_floatValues[index]);
20989 }
20990 // there are some float values which may be negative or can't get negative due to other checks
20991 else if ((index >= UNIT_FIELD_NEGSTAT0 && index <= UNIT_FIELD_NEGSTAT4) ||
20994 (index >= UNIT_FIELD_POSSTAT0 && index <= UNIT_FIELD_POSSTAT4))
20995 {
20996 fieldBuffer << uint32(m_floatValues[index]);
20997 }
20998 // Gamemasters should be always able to select units - remove not selectable flag
20999 else if (index == UNIT_FIELD_FLAGS)
21000 {
21001 uint32 appendValue = m_uint32Values[UNIT_FIELD_FLAGS];
21002 if (target->IsGameMaster() && AccountMgr::IsGMAccount(target->GetSession()->GetSecurity()))
21003 appendValue &= ~UNIT_FLAG_NOT_SELECTABLE;
21004
21005 fieldBuffer << uint32(appendValue);
21006 }
21007 // use modelid_a if not gm, _h if gm for CREATURE_FLAG_EXTRA_TRIGGER creatures
21008 else if (index == UNIT_FIELD_DISPLAYID)
21009 {
21011 if (creature)
21012 {
21013 CreatureTemplate const* cinfo = creature->GetCreatureTemplate();
21014
21015 // this also applies for transform auras
21016 if (SpellInfo const* transform = sSpellMgr->GetSpellInfo(getTransForm()))
21017 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
21018 if (transform->Effects[i].IsAura(SPELL_AURA_TRANSFORM))
21019 if (CreatureTemplate const* transformInfo = sObjectMgr->GetCreatureTemplate(transform->Effects[i].MiscValue))
21020 {
21021 cinfo = transformInfo;
21022 break;
21023 }
21024
21026 {
21027 if (target->IsGameMaster() && AccountMgr::IsGMAccount(target->GetSession()->GetSecurity()))
21028 {
21029 if (cinfo->Modelid1)
21030 displayId = cinfo->Modelid1; // Modelid1 is a visible model for gms
21031 else
21032 displayId = 17519; // world visible trigger's model
21033 }
21034 else
21035 {
21036 if (cinfo->Modelid2)
21037 displayId = cinfo->Modelid2; // Modelid2 is an invisible model for players
21038 else
21039 displayId = 11686; // world invisible trigger's model
21040 }
21041 }
21042 }
21043
21044 fieldBuffer << uint32(displayId);
21045 }
21046 // hide lootable animation for unallowed players
21047 else if (index == UNIT_DYNAMIC_FLAGS)
21048 {
21050
21051 if (creature)
21052 {
21053 if (creature->hasLootRecipient())
21054 {
21055 dynamicFlags |= UNIT_DYNFLAG_TAPPED;
21056 if (creature->isTappedBy(target))
21057 dynamicFlags |= UNIT_DYNFLAG_TAPPED_BY_PLAYER;
21058 }
21059
21060 if (!target->isAllowedToLoot(creature))
21061 dynamicFlags &= ~UNIT_DYNFLAG_LOOTABLE;
21062 }
21063
21064 // unit UNIT_DYNFLAG_TRACK_UNIT should only be sent to caster of SPELL_AURA_MOD_STALKED auras
21065 if (dynamicFlags & UNIT_DYNFLAG_TRACK_UNIT)
21067 dynamicFlags &= ~UNIT_DYNFLAG_TRACK_UNIT;
21068
21069 fieldBuffer << dynamicFlags;
21070 }
21071 // FG: pretend that OTHER players in own group are friendly ("blue")
21072 else if (index == UNIT_FIELD_BYTES_2 || index == UNIT_FIELD_FACTIONTEMPLATE)
21073 {
21074 if (IsControlledByPlayer() && target != this && sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && IsInRaidWith(target))
21075 {
21077 FactionTemplateEntry const* ft2 = target->GetFactionTemplateEntry();
21078 if (ft1 && ft2 && !ft1->IsFriendlyTo(*ft2))
21079 {
21080 if (index == UNIT_FIELD_BYTES_2)
21081 // Allow targetting opposite faction in party when enabled in config
21082 fieldBuffer << (m_uint32Values[UNIT_FIELD_BYTES_2] & ((UNIT_BYTE2_FLAG_SANCTUARY /*| UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5*/) << 8)); // this flag is at uint8 offset 1 !!
21083 else
21084 // pretend that all other HOSTILE players have own faction, to allow follow, heal, rezz (trade wont work)
21085 fieldBuffer << uint32(target->GetFaction());
21086 }
21087 else
21088 fieldBuffer << m_uint32Values[index];
21089 }// pussywizard / Callmephil
21090 else if (target->IsSpectator() && target->FindMap() && target->FindMap()->IsBattleArena() &&
21091 (this->GetTypeId() == TYPEID_PLAYER || this->GetTypeId() == TYPEID_UNIT || this->GetTypeId() == TYPEID_DYNAMICOBJECT))
21092 {
21093 if (index == UNIT_FIELD_BYTES_2)
21094 fieldBuffer << (m_uint32Values[index] & 0xFFFFF2FF); // clear UNIT_BYTE2_FLAG_PVP, UNIT_BYTE2_FLAG_FFA_PVP, UNIT_BYTE2_FLAG_SANCTUARY
21095 else
21096 fieldBuffer << (uint32)target->GetFaction();
21097 }
21098 else
21099 if (!sScriptMgr->IsCustomBuildValuesUpdate(this, updateType, fieldBuffer, target, index))
21100 {
21101 fieldBuffer << m_uint32Values[index];
21102 }
21103 }
21104 else
21105 {
21106 if (sScriptMgr->OnBuildValuesUpdate(this, updateType, fieldBuffer, target, index))
21107 {
21108 continue;
21109 }
21110
21111 // send in current format (float as float, uint32 as uint32)
21112 fieldBuffer << m_uint32Values[index];
21113 }
21114 }
21115 }
21116
21117 *data << uint8(updateMask.GetBlockCount());
21118 updateMask.AppendToPacket(data);
21119 data->append(fieldBuffer);
21120}
@ CREATURE_FLAG_EXTRA_TRIGGER
Definition: CreatureData.h:56
@ TYPEID_DYNAMICOBJECT
Definition: ObjectGuid.h:40
@ UPDATETYPE_VALUES
Definition: UpdateData.h:28
uint32 UnitUpdateFieldFlags[PLAYER_END]
Definition: UpdateFieldFlags.cpp:162
@ UF_FLAG_SPECIAL_INFO
Definition: UpdateFieldFlags.h:32
@ UF_FLAG_PUBLIC
Definition: UpdateFieldFlags.h:27
@ UF_FLAG_OWNER
Definition: UpdateFieldFlags.h:29
@ UF_FLAG_PRIVATE
Definition: UpdateFieldFlags.h:28
@ UF_FLAG_PARTY_MEMBER
Definition: UpdateFieldFlags.h:33
@ UNIT_NPC_FLAGS
Definition: UpdateFields.h:139
@ UNIT_FIELD_RANGEDATTACKTIME
Definition: UpdateFields.h:121
@ UNIT_FIELD_DISPLAYID
Definition: UpdateFields.h:124
@ UNIT_FIELD_FACTIONTEMPLATE
Definition: UpdateFields.h:115
@ UNIT_FIELD_POSSTAT4
Definition: UpdateFields.h:150
@ UNIT_FIELD_NEGSTAT4
Definition: UpdateFields.h:155
@ UNIT_FIELD_FLAGS
Definition: UpdateFields.h:117
@ UNIT_DYNAMIC_FLAGS
Definition: UpdateFields.h:136
@ UNIT_NPC_FLAG_GOSSIP
Definition: Unit.h:516
@ UNIT_NPC_FLAG_FLIGHTMASTER
Definition: Unit.h:529
@ UNIT_BYTE2_FLAG_SANCTUARY
Definition: Unit.h:139
#define sObjectMgr
Definition: ObjectMgr.h:1620
@ SPELL_AURA_EMPATHY
Definition: SpellAuraDefines.h:184
@ SPELL_AURA_MOD_STALKED
Definition: SpellAuraDefines.h:131
@ SPELL_AURA_TRANSFORM
Definition: SpellAuraDefines.h:119
@ CONFIG_INSTANT_TAXI
Definition: IWorld.h:375
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP
Definition: IWorld.h:80
@ UNIT_DYNFLAG_SPECIALINFO
Definition: SharedDefines.h:3097
@ UNIT_DYNFLAG_TAPPED_BY_PLAYER
Definition: SharedDefines.h:3096
@ UNIT_DYNFLAG_TAPPED
Definition: SharedDefines.h:3095
@ UNIT_DYNFLAG_LOOTABLE
Definition: SharedDefines.h:3093
@ UNIT_DYNFLAG_TRACK_UNIT
Definition: SharedDefines.h:3094
bool IsGMAccount(uint32 gmlevel)
Definition: AccountMgr.cpp:281
bool IsValidTrainerForPlayer(Player *player, uint32 *npcFlags=nullptr) const
Definition: Creature.cpp:1228
bool hasLootRecipient() const
Definition: Creature.h:223
bool isTappedBy(Player const *player) const
Definition: Creature.cpp:1344
Definition: CreatureData.h:176
uint32 Modelid1
Definition: CreatureData.h:180
uint32 Modelid2
Definition: CreatureData.h:181
uint16 _fieldNotifyFlags
Definition: Object.h:244
bool HasDynamicFlag(uint32 flag) const
Definition: Object.h:116
UpdateMask _changesMask
Definition: Object.h:240
uint32 * m_uint32Values
Definition: Object.h:236
uint16 m_valuesCount
Definition: Object.h:242
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:889
float * m_floatValues
Definition: Object.h:237
Map * FindMap() const
Definition: Object.h:518
Definition: UpdateMask.h:26
uint32 GetBlockCount() const
Definition: UpdateMask.h:63
bool GetBit(uint32 index) const
Definition: UpdateMask.h:48
void SetCount(uint32 valuesCount)
Definition: UpdateMask.h:66
void SetBit(uint32 index)
Definition: UpdateMask.h:46
void AppendToPacket(ByteBuffer *data)
Definition: UpdateMask.h:50
bool isAllowedToLoot(Creature const *creature)
Definition: PlayerStorage.cpp:5642
bool IsInSameRaidWith(Player const *p) const
Definition: Player.h:1836
WorldSession * GetSession() const
Definition: Player.h:1948
bool CanSeeVendor(Creature const *creature) const
Definition: Player.cpp:14181
bool IsSpectator() const
Definition: Player.h:2523
bool CanSeeSpellClickOn(Creature const *creature) const
Definition: Player.cpp:14158
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition: Unit.cpp:10576
bool HasAuraTypeWithCaster(AuraType auratype, ObjectGuid caster) const
Definition: Unit.cpp:5622
uint32 GetFaction() const
Definition: Unit.h:1495
uint32 BuildAuraStateUpdateForTarget(Unit *target) const
Definition: Unit.cpp:10496
bool IsInRaidWith(Unit const *unit) const
Definition: Unit.cpp:18935
ObjectGuid GetOwnerGUID() const
Definition: Unit.h:1814
uint32 getTransForm() const
Definition: Unit.h:2174
bool IsBattleArena() const
Definition: Map.h:454
AccountTypes GetSecurity() const
Definition: WorldSession.h:357
bool IsFriendlyTo(FactionTemplateEntry const &entry) const
Definition: DBCStructure.h:942
Definition: ByteBuffer.h:70
void append(T value)
Definition: ByteBuffer.h:129

References Object::_changesMask, Object::_fieldNotifyFlags, ByteBuffer::append(), UpdateMask::AppendToPacket(), BuildAuraStateUpdateForTarget(), Player::CanSeeSpellClickOn(), Player::CanSeeVendor(), CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP, CONFIG_INSTANT_TAXI, CREATURE_FLAG_EXTRA_TRIGGER, WorldObject::FindMap(), CreatureTemplate::flags_extra, UpdateMask::GetBit(), UpdateMask::GetBlockCount(), GetCharmerOrOwnerPlayerOrPlayerItself(), Creature::GetCreatureTemplate(), GetFaction(), GetFactionTemplateEntry(), Object::GetGUID(), GetOwnerGUID(), WorldSession::GetSecurity(), Player::GetSession(), getTransForm(), HasAuraTypeWithCaster(), Object::HasDynamicFlag(), Object::HasFlag(), Creature::hasLootRecipient(), Player::isAllowedToLoot(), Map::IsBattleArena(), IsControlledByPlayer(), FactionTemplateEntry::IsFriendlyTo(), Player::IsGameMaster(), AccountMgr::IsGMAccount(), IsInRaidWith(), Player::IsInSameRaidWith(), Player::IsSpectator(), Creature::isTappedBy(), Creature::IsValidTrainerForPlayer(), Object::m_floatValues, Object::m_uint32Values, Object::m_valuesCount, MAX_SPELL_EFFECTS, CreatureTemplate::Modelid1, CreatureTemplate::Modelid2, PER_CASTER_AURA_STATE_MASK, UpdateMask::SetBit(), UpdateMask::SetCount(), sObjectMgr, SPELL_AURA_EMPATHY, SPELL_AURA_MOD_STALKED, SPELL_AURA_TRANSFORM, sScriptMgr, sSpellMgr, sWorld, Object::ToCreature(), TYPEID_DYNAMICOBJECT, TYPEID_PLAYER, TYPEID_UNIT, UF_FLAG_OWNER, UF_FLAG_PARTY_MEMBER, UF_FLAG_PRIVATE, UF_FLAG_PUBLIC, UF_FLAG_SPECIAL_INFO, UNIT_BYTE2_FLAG_SANCTUARY, UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE, UNIT_DYNFLAG_SPECIALINFO, UNIT_DYNFLAG_TAPPED, UNIT_DYNFLAG_TAPPED_BY_PLAYER, UNIT_DYNFLAG_TRACK_UNIT, UNIT_FIELD_AURASTATE, UNIT_FIELD_BASEATTACKTIME, UNIT_FIELD_BYTES_2, UNIT_FIELD_DISPLAYID, UNIT_FIELD_FACTIONTEMPLATE, UNIT_FIELD_FLAGS, UNIT_FIELD_NEGSTAT0, UNIT_FIELD_NEGSTAT4, UNIT_FIELD_POSSTAT0, UNIT_FIELD_POSSTAT4, UNIT_FIELD_RANGEDATTACKTIME, UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE, UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE, UNIT_NPC_FLAG_FLIGHTMASTER, UNIT_NPC_FLAG_GOSSIP, UNIT_NPC_FLAGS, UnitUpdateFieldFlags, and UPDATETYPE_VALUES.

◆ CalcAbsorbResist()

void Unit::CalcAbsorbResist ( DamageInfo dmgInfo,
bool  Splited = false 
)
static
2118{
2119 Unit* victim = dmgInfo.GetVictim();
2120 Unit* attacker = dmgInfo.GetAttacker();
2121 uint32 damage = dmgInfo.GetDamage();
2122 SpellSchoolMask schoolMask = dmgInfo.GetSchoolMask();
2123 SpellInfo const* spellInfo = dmgInfo.GetSpellInfo();
2124
2125 if (!victim || !victim->IsAlive() || !damage)
2126 return;
2127
2128 // Magic damage, check for resists
2129 // Ignore spells that cant be resisted
2130 // Xinef: holy resistance exists for npcs
2131 if (!(schoolMask & SPELL_SCHOOL_MASK_NORMAL) && (!(schoolMask & SPELL_SCHOOL_MASK_HOLY) || victim->GetTypeId() == TYPEID_UNIT) && (!spellInfo || (!spellInfo->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL) && !spellInfo->HasAttribute(SPELL_ATTR4_NO_CAST_LOG))))
2132 {
2133 float averageResist = Unit::GetEffectiveResistChance(attacker, schoolMask, victim);
2134
2135 float discreteResistProbability[11];
2136 for (uint32 i = 0; i < 11; ++i)
2137 {
2138 discreteResistProbability[i] = 0.5f - 2.5f * std::fabs(0.1f * i - averageResist);
2139 if (discreteResistProbability[i] < 0.0f)
2140 discreteResistProbability[i] = 0.0f;
2141 }
2142
2143 if (averageResist <= 0.1f)
2144 {
2145 discreteResistProbability[0] = 1.0f - 7.5f * averageResist;
2146 discreteResistProbability[1] = 5.0f * averageResist;
2147 discreteResistProbability[2] = 2.5f * averageResist;
2148 }
2149
2150 float r = float(rand_norm());
2151 uint32 i = 0;
2152 float probabilitySum = discreteResistProbability[0];
2153
2154 while (r >= probabilitySum && i < 10)
2155 probabilitySum += discreteResistProbability[++i];
2156
2157 float damageResisted = float(damage * i / 10);
2158
2159 if (damageResisted) // if equal to 0, checking these is pointless
2160 {
2161 if (attacker)
2162 {
2164 for (AuraEffectList::const_iterator j = ResIgnoreAurasAb.begin(); j != ResIgnoreAurasAb.end(); ++j)
2165 if (((*j)->GetMiscValue() & schoolMask) && (*j)->IsAffectedOnSpell(spellInfo))
2166 AddPct(damageResisted, -(*j)->GetAmount());
2167
2169 for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j)
2170 if ((*j)->GetMiscValue() & schoolMask)
2171 AddPct(damageResisted, -(*j)->GetAmount());
2172 }
2173
2174 // pussywizard:
2175 if (spellInfo && spellInfo->HasAttribute(SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC))
2176 {
2177 uint32 damageAfterArmor = Unit::CalcArmorReducedDamage(attacker, victim, damage, spellInfo, 0, BASE_ATTACK);
2178 uint32 armorReduction = damage - damageAfterArmor;
2179 if (armorReduction < damageResisted) // pick the lower one, the weakest resistance counts
2180 damageResisted = armorReduction;
2181 }
2182 }
2183
2184 dmgInfo.ResistDamage(uint32(damageResisted));
2185 }
2186
2187 // Ignore Absorption Auras
2188 float auraAbsorbMod = 0;
2189 if (attacker)
2190 {
2192 for (AuraEffectList::const_iterator itr = AbsIgnoreAurasA.begin(); itr != AbsIgnoreAurasA.end(); ++itr)
2193 {
2194 if (!((*itr)->GetMiscValue() & schoolMask))
2195 continue;
2196
2197 if ((*itr)->GetAmount() > auraAbsorbMod)
2198 auraAbsorbMod = float((*itr)->GetAmount());
2199 }
2200
2202 for (AuraEffectList::const_iterator itr = AbsIgnoreAurasB.begin(); itr != AbsIgnoreAurasB.end(); ++itr)
2203 {
2204 if (!((*itr)->GetMiscValue() & schoolMask))
2205 continue;
2206
2207 if (((*itr)->GetAmount() > auraAbsorbMod) && (*itr)->IsAffectedOnSpell(spellInfo))
2208 auraAbsorbMod = float((*itr)->GetAmount());
2209 }
2210 RoundToInterval(auraAbsorbMod, 0.0f, 100.0f);
2211 }
2212
2213 // We're going to call functions which can modify content of the list during iteration over it's elements
2214 // Let's copy the list so we can prevent iterator invalidation
2216 vSchoolAbsorbCopy.sort(Acore::AbsorbAuraOrderPred());
2217
2218 // absorb without mana cost
2219 for (AuraEffectList::iterator itr = vSchoolAbsorbCopy.begin(); (itr != vSchoolAbsorbCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
2220 {
2221 AuraEffect* absorbAurEff = *itr;
2222 // Check if aura was removed during iteration - we don't need to work on such auras
2223 AuraApplication const* aurApp = absorbAurEff->GetBase()->GetApplicationOfTarget(victim->GetGUID());
2224 if (!aurApp)
2225 continue;
2226 if (!(absorbAurEff->GetMiscValue() & schoolMask))
2227 continue;
2228
2229 // get amount which can be still absorbed by the aura
2230 int32 currentAbsorb = absorbAurEff->GetAmount();
2231 // aura with infinite absorb amount - let the scripts handle absorbtion amount, set here to 0 for safety
2232 if (currentAbsorb < 0)
2233 currentAbsorb = 0;
2234
2235 uint32 tempAbsorb = uint32(currentAbsorb);
2236
2237 bool defaultPrevented = false;
2238
2239 absorbAurEff->GetBase()->CallScriptEffectAbsorbHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb, defaultPrevented);
2240 currentAbsorb = tempAbsorb;
2241
2242 if (defaultPrevented)
2243 continue;
2244
2245 // absorb must be smaller than the damage itself
2246 currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(dmgInfo.GetDamage()));
2247
2248 // xinef: do this after absorb is rounded to damage...
2249 AddPct(currentAbsorb, -auraAbsorbMod);
2250
2251 dmgInfo.AbsorbDamage(currentAbsorb);
2252
2253 tempAbsorb = currentAbsorb;
2254 absorbAurEff->GetBase()->CallScriptEffectAfterAbsorbHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb);
2255
2256 // Check if our aura is using amount to count damage
2257 if (absorbAurEff->GetAmount() >= 0)
2258 {
2259 // Reduce shield amount
2260 absorbAurEff->SetAmount(absorbAurEff->GetAmount() - currentAbsorb);
2261 // Aura cannot absorb anything more - remove it
2262 if (absorbAurEff->GetAmount() <= 0)
2263 absorbAurEff->GetBase()->Remove(AURA_REMOVE_BY_ENEMY_SPELL);
2264 }
2265 }
2266
2267 // absorb by mana cost
2269 for (AuraEffectList::const_iterator itr = vManaShieldCopy.begin(); (itr != vManaShieldCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
2270 {
2271 AuraEffect* absorbAurEff = *itr;
2272 // Check if aura was removed during iteration - we don't need to work on such auras
2273 AuraApplication const* aurApp = absorbAurEff->GetBase()->GetApplicationOfTarget(victim->GetGUID());
2274 if (!aurApp)
2275 continue;
2276 // check damage school mask
2277 if (!(absorbAurEff->GetMiscValue() & schoolMask))
2278 continue;
2279
2280 // get amount which can be still absorbed by the aura
2281 int32 currentAbsorb = absorbAurEff->GetAmount();
2282 // aura with infinite absorb amount - let the scripts handle absorbtion amount, set here to 0 for safety
2283 if (currentAbsorb < 0)
2284 currentAbsorb = 0;
2285
2286 uint32 tempAbsorb = currentAbsorb;
2287
2288 bool defaultPrevented = false;
2289
2290 absorbAurEff->GetBase()->CallScriptEffectManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb, defaultPrevented);
2291 currentAbsorb = tempAbsorb;
2292
2293 if (defaultPrevented)
2294 continue;
2295
2296 // absorb must be smaller than the damage itself
2297 currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(dmgInfo.GetDamage()));
2298
2299 // xinef: do this after absorb is rounded to damage...
2300 AddPct(currentAbsorb, -auraAbsorbMod);
2301
2302 int32 manaReduction = currentAbsorb;
2303
2304 // lower absorb amount by talents
2305 if (float manaMultiplier = absorbAurEff->GetSpellInfo()->Effects[absorbAurEff->GetEffIndex()].CalcValueMultiplier(absorbAurEff->GetCaster()))
2306 manaReduction = int32(float(manaReduction) * manaMultiplier);
2307
2308 int32 manaTaken = -victim->ModifyPower(POWER_MANA, -manaReduction);
2309
2310 // take case when mana has ended up into account
2311 currentAbsorb = currentAbsorb ? int32(float(currentAbsorb) * (float(manaTaken) / float(manaReduction))) : 0;
2312
2313 dmgInfo.AbsorbDamage(currentAbsorb);
2314
2315 tempAbsorb = currentAbsorb;
2316 absorbAurEff->GetBase()->CallScriptEffectAfterManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb);
2317
2318 // Check if our aura is using amount to count damage
2319 if (absorbAurEff->GetAmount() >= 0)
2320 {
2321 absorbAurEff->SetAmount(absorbAurEff->GetAmount() - currentAbsorb);
2322 if ((absorbAurEff->GetAmount() <= 0))
2323 absorbAurEff->GetBase()->Remove(AURA_REMOVE_BY_ENEMY_SPELL);
2324 }
2325 }
2326
2327 // split damage auras - only when not damaging self
2328 // Xinef: not true - Warlock Hellfire
2329 if (/*victim != attacker &&*/ !Splited)
2330 {
2331 // We're going to call functions which can modify content of the list during iteration over it's elements
2332 // Let's copy the list so we can prevent iterator invalidation
2334 for (AuraEffectList::iterator itr = vSplitDamageFlatCopy.begin(); (itr != vSplitDamageFlatCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
2335 {
2336 // Check if aura was removed during iteration - we don't need to work on such auras
2337 if (!((*itr)->GetBase()->IsAppliedOnTarget(victim->GetGUID())))
2338 continue;
2339 // check damage school mask
2340 if (!((*itr)->GetMiscValue() & schoolMask))
2341 continue;
2342
2343 // Damage can be splitted only if aura has an alive caster
2344 Unit* caster = (*itr)->GetCaster();
2345 if (!caster || (caster == victim) || !caster->IsInWorld() || !caster->IsAlive())
2346 continue;
2347
2348 int32 splitDamage = (*itr)->GetAmount();
2349
2350 // absorb must be smaller than the damage itself
2351 splitDamage = RoundToInterval(splitDamage, 0, int32(dmgInfo.GetDamage()));
2352
2353 dmgInfo.AbsorbDamage(splitDamage);
2354
2355 uint32 splitted = splitDamage;
2356 uint32 splitted_absorb = 0;
2357 uint32 splitted_resist = 0;
2358
2359 uint32 procAttacker = 0, procVictim = 0, procEx = PROC_EX_NORMAL_HIT;
2360 DamageInfo splittedDmgInfo(attacker, caster, splitted, spellInfo, schoolMask, dmgInfo.GetDamageType());
2361 if (caster->IsImmunedToDamageOrSchool(schoolMask))
2362 {
2363 procEx |= PROC_EX_IMMUNE;
2364 splittedDmgInfo.AbsorbDamage(splitted);
2365 }
2366 else
2367 {
2368 Unit::CalcAbsorbResist(splittedDmgInfo, true);
2369 Unit::DealDamageMods(caster, splitted, &splitted_absorb);
2370 }
2371
2372 splitted_absorb = splittedDmgInfo.GetAbsorb();
2373 splitted_resist = splittedDmgInfo.GetResist();
2374 splitted = splittedDmgInfo.GetDamage();
2375
2376 // create procs
2377 createProcFlags(spellInfo, BASE_ATTACK, false, procAttacker, procVictim);
2378 caster->ProcDamageAndSpellFor(true, attacker, procVictim, procEx, BASE_ATTACK, spellInfo, splitted, nullptr, -1, nullptr, &splittedDmgInfo);
2379
2380 if (attacker)
2381 {
2382 attacker->SendSpellNonMeleeDamageLog(caster, (*itr)->GetSpellInfo(), splitted, schoolMask, splitted_absorb, splitted_resist, false, 0, false, true);
2383 }
2384
2385 CleanDamage cleanDamage = CleanDamage(splitted, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
2386 Unit::DealDamage(attacker, caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*itr)->GetSpellInfo(), false);
2387 }
2388
2389 // We're going to call functions which can modify content of the list during iteration over it's elements
2390 // Let's copy the list so we can prevent iterator invalidation
2392 for (AuraEffectList::iterator itr = vSplitDamagePctCopy.begin(), next; (itr != vSplitDamagePctCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
2393 {
2394 // Check if aura was removed during iteration - we don't need to work on such auras
2395 AuraApplication const* aurApp = (*itr)->GetBase()->GetApplicationOfTarget(victim->GetGUID());
2396 if (!aurApp)
2397 continue;
2398
2399 // check damage school mask
2400 if (!((*itr)->GetMiscValue() & schoolMask))
2401 continue;
2402
2403 // Damage can be splitted only if aura has an alive caster
2404 Unit* caster = (*itr)->GetCaster();
2405 if (!caster || (caster == victim) || !caster->IsInWorld() || !caster->IsAlive())
2406 continue;
2407
2408 // Xinef: Single Target splits require LoS
2409 SpellInfo const* splitSpellInfo = (*itr)->GetSpellInfo();
2410 if (!splitSpellInfo->Effects[(*itr)->GetEffIndex()].IsAreaAuraEffect() && !splitSpellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT))
2411 if (!caster->IsWithinLOSInMap(victim) || !caster->IsWithinDist(victim, splitSpellInfo->GetMaxRange(splitSpellInfo->IsPositive(), caster)))
2412 continue;
2413
2414 uint32 splitDamage = CalculatePct(dmgInfo.GetDamage(), (*itr)->GetAmount());
2415 SpellSchoolMask splitSchoolMask = schoolMask;
2416
2417 (*itr)->GetBase()->CallScriptEffectSplitHandlers(*itr, aurApp, dmgInfo, splitDamage);
2418
2419 // absorb must be smaller than the damage itself
2420 splitDamage = RoundToInterval(splitDamage, uint32(0), uint32(dmgInfo.GetDamage()));
2421
2422 // Roar of Sacrifice, dont absorb it
2423 if (splitSpellInfo->Id != 53480)
2424 dmgInfo.AbsorbDamage(splitDamage);
2425 else
2426 splitSchoolMask = SPELL_SCHOOL_MASK_NATURE;
2427
2428 uint32 splitted = splitDamage;
2429 uint32 splitted_absorb = 0;
2430 uint32 splitted_resist = 0;
2431
2432 uint32 procAttacker = 0, procVictim = 0, procEx = PROC_EX_NORMAL_HIT;
2433 DamageInfo splittedDmgInfo(attacker, caster, splitted, spellInfo, splitSchoolMask, dmgInfo.GetDamageType());
2434 if (caster->IsImmunedToDamageOrSchool(schoolMask))
2435 {
2436 procEx |= PROC_EX_IMMUNE;
2437 splittedDmgInfo.AbsorbDamage(splitted);
2438 }
2439 else
2440 {
2441 Unit::CalcAbsorbResist(splittedDmgInfo, true);
2442 Unit::DealDamageMods(caster, splitted, &splitted_absorb);
2443 }
2444
2445 splitted_absorb = splittedDmgInfo.GetAbsorb();
2446 splitted_resist = splittedDmgInfo.GetResist();
2447 splitted = splittedDmgInfo.GetDamage();
2448
2449 // create procs
2450 createProcFlags(spellInfo, BASE_ATTACK, false, procAttacker, procVictim);
2451 caster->ProcDamageAndSpellFor(true, attacker, procVictim, procEx, BASE_ATTACK, spellInfo, splitted);
2452
2453 if (attacker)
2454 {
2455 attacker->SendSpellNonMeleeDamageLog(caster, splitSpellInfo, splitted, splitSchoolMask, splitted_absorb, splitted_resist, false, 0, false, true);
2456 }
2457
2458 CleanDamage cleanDamage = CleanDamage(splitted, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
2459 Unit::DealDamage(attacker, caster, splitted, &cleanDamage, DIRECT_DAMAGE, splitSchoolMask, splitSpellInfo, false);
2460 }
2461 }
2462}
double rand_norm()
Definition: Random.cpp:77
T AddPct(T &base, U pct)
Definition: Util.h:67
T RoundToInterval(T &num, T floor, T ceil)
Definition: Util.h:79
T CalculatePct(T base, U pct)
Definition: Util.h:61
void createProcFlags(SpellInfo const *spellInfo, WeaponAttackType attackType, bool positive, uint32 &procAttacker, uint32 &procVictim)
Definition: Unit.cpp:16068
@ MELEE_HIT_NORMAL
Definition: Unit.h:717
@ DIRECT_DAMAGE
Definition: Unit.h:435
@ SPELL_AURA_MANA_SHIELD
Definition: SpellAuraDefines.h:160
@ SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL
Definition: SpellAuraDefines.h:257
@ SPELL_AURA_MOD_IGNORE_TARGET_RESIST
Definition: SpellAuraDefines.h:332
@ SPELL_AURA_SPLIT_DAMAGE_FLAT
Definition: SpellAuraDefines.h:216
@ SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL
Definition: SpellAuraDefines.h:258
@ SPELL_AURA_SPLIT_DAMAGE_PCT
Definition: SpellAuraDefines.h:144
@ SPELL_AURA_SCHOOL_ABSORB
Definition: SpellAuraDefines.h:132
@ SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST
Definition: SpellAuraDefines.h:333
@ AURA_REMOVE_BY_ENEMY_SPELL
Definition: SpellAuraDefines.h:394
@ SPELL_ATTR0_CU_BINARY_SPELL
Definition: SpellInfo.h:196
@ SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC
Definition: SpellInfo.h:199
@ PROC_EX_NORMAL_HIT
Definition: SpellMgr.h:194
@ PROC_EX_IMMUNE
Definition: SpellMgr.h:202
@ POWER_MANA
Definition: SharedDefines.h:241
@ SPELL_ATTR2_IGNORE_LINE_OF_SIGHT
Definition: SharedDefines.h:430
@ SPELL_ATTR4_NO_CAST_LOG
Definition: SharedDefines.h:502
SpellSchoolMask
Definition: SharedDefines.h:267
@ SPELL_SCHOOL_MASK_NORMAL
Definition: SharedDefines.h:269
@ SPELL_SCHOOL_MASK_NATURE
Definition: SharedDefines.h:272
@ SPELL_SCHOOL_MASK_HOLY
Definition: SharedDefines.h:270
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition: Object.cpp:1316
Definition: Unit.h:746
void ResistDamage(uint32 amount)
Definition: Unit.cpp:161
void AbsorbDamage(uint32 amount)
Definition: Unit.cpp:154
Unit * GetVictim() const
Definition: Unit.h:790
Unit * GetAttacker() const
Definition: Unit.h:789
SpellInfo const * GetSpellInfo() const
Definition: Unit.h:791
DamageEffectType GetDamageType() const
Definition: Unit.h:793
SpellSchoolMask GetSchoolMask() const
Definition: Unit.h:792
uint32 GetDamage() const
Definition: Unit.h:795
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition: Unit.cpp:14056
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1967
static uint32 CalcArmorReducedDamage(Unit const *attacker, Unit const *victim, const uint32 damage, SpellInfo const *spellInfo, uint8 attackerLevel=0, WeaponAttackType attackType=MAX_ATTACK)
Definition: Unit.cpp:2001
static float GetEffectiveResistChance(Unit const *owner, SpellSchoolMask schoolMask, Unit const *victim)
Definition: Unit.cpp:2083
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log)
Definition: Unit.cpp:6222
void ProcDamageAndSpellFor(bool isVictim, Unit *target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const *procSpellInfo, uint32 damage, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
Definition: Unit.cpp:16202
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:1306
bool IsImmunedToDamageOrSchool(SpellSchoolMask meleeSchoolMask) const
Definition: Unit.cpp:12817
static void CalcAbsorbResist(DamageInfo &dmgInfo, bool Splited=false)
Definition: Unit.cpp:2117
static uint32 DealDamage(Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true, bool allowGM=false, Spell const *spell=nullptr)
Definition: Unit.cpp:815
Definition: SpellAuraEffects.h:39
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:54
void SetAmount(int32 amount)
Definition: SpellAuraEffects.h:65
Unit * GetCaster() const
Definition: SpellAuraEffects.h:47
int32 GetMiscValue() const
Definition: SpellAuraEffects.cpp:442
Aura * GetBase() const
Definition: SpellAuraEffects.h:49
uint32 GetEffIndex() const
Definition: SpellAuraEffects.h:56
int32 GetAmount() const
Definition: SpellAuraEffects.h:63
Definition: SpellAuraEffects.h:347
void CallScriptEffectAbsorbHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount, bool &defaultPrevented)
Definition: SpellAuras.cpp:2563
void CallScriptEffectAfterAbsorbHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount)
Definition: SpellAuras.cpp:2581
void CallScriptEffectManaShieldHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount, bool &defaultPrevented)
Definition: SpellAuras.cpp:2595
void CallScriptEffectAfterManaShieldHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount)
Definition: SpellAuras.cpp:2609
virtual void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)=0
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition: SpellInfo.h:391
float GetMaxRange(bool positive=false, Unit *caster=nullptr, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:2306
bool IsPositive() const
Definition: SpellInfo.cpp:1221

References DamageInfo::AbsorbDamage(), AddPct(), AURA_REMOVE_BY_ENEMY_SPELL, BASE_ATTACK, CalcAbsorbResist(), CalcArmorReducedDamage(), CalculatePct(), Aura::CallScriptEffectAbsorbHandlers(), Aura::CallScriptEffectAfterAbsorbHandlers(), Aura::CallScriptEffectAfterManaShieldHandlers(), Aura::CallScriptEffectManaShieldHandlers(), createProcFlags(), DealDamage(), DealDamageMods(), DIRECT_DAMAGE, SpellInfo::Effects, DamageInfo::GetAbsorb(), AuraEffect::GetAmount(), Aura::GetApplicationOfTarget(), DamageInfo::GetAttacker(), GetAuraEffectsByType(), AuraEffect::GetBase(), AuraApplication::GetBase(), AuraEffect::GetCaster(), DamageInfo::GetDamage(), DamageInfo::GetDamageType(), GetEffectiveResistChance(), AuraEffect::GetEffIndex(), Object::GetGUID(), SpellInfo::GetMaxRange(), AuraEffect::GetMiscValue(), DamageInfo::GetResist(), DamageInfo::GetSchoolMask(), DamageInfo::GetSpellInfo(), AuraEffect::GetSpellInfo(), Object::GetTypeId(), DamageInfo::GetVictim(), SpellInfo::HasAttribute(), SpellInfo::Id, IsAlive(), IsImmunedToDamageOrSchool(), Object::IsInWorld(), SpellInfo::IsPositive(), WorldObject::IsWithinDist(), WorldObject::IsWithinLOSInMap(), MELEE_HIT_NORMAL, ModifyPower(), POWER_MANA, PROC_EX_IMMUNE, PROC_EX_NORMAL_HIT, ProcDamageAndSpellFor(), rand_norm(), Aura::Remove(), DamageInfo::ResistDamage(), RoundToInterval(), SendSpellNonMeleeDamageLog(), AuraEffect::SetAmount(), SPELL_ATTR0_CU_BINARY_SPELL, SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC, SPELL_ATTR2_IGNORE_LINE_OF_SIGHT, SPELL_ATTR4_NO_CAST_LOG, SPELL_AURA_MANA_SHIELD, SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL, SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL, SPELL_AURA_SCHOOL_ABSORB, SPELL_AURA_SPLIT_DAMAGE_FLAT, SPELL_AURA_SPLIT_DAMAGE_PCT, SPELL_SCHOOL_MASK_HOLY, SPELL_SCHOOL_MASK_NATURE, SPELL_SCHOOL_MASK_NORMAL, and TYPEID_UNIT.

Referenced by CalcAbsorbResist(), CalculateSpellDamageTaken(), DealDamage(), DealMeleeDamage(), Player::EnvironmentalDamage(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), and spell_valkyr_touch::spell_valkyr_touchAuraScript::PrepareAuraScript().

◆ CalcArmorReducedDamage()

uint32 Unit::CalcArmorReducedDamage ( Unit const *  attacker,
Unit const *  victim,
const uint32  damage,
SpellInfo const *  spellInfo,
uint8  attackerLevel = 0,
WeaponAttackType  attackType = MAX_ATTACK 
)
static
2002{
2003 float armor = float(victim->GetArmor());
2004
2005 // Ignore enemy armor by SPELL_AURA_MOD_TARGET_RESISTANCE aura
2006 if (attacker)
2007 {
2008 armor += attacker->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, SPELL_SCHOOL_MASK_NORMAL);
2009
2010 if (spellInfo)
2011 if (Player* modOwner = attacker->GetSpellModOwner())
2012 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_IGNORE_ARMOR, armor);
2013
2014 AuraEffectList const& ResIgnoreAurasAb = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST);
2015 for (AuraEffectList::const_iterator j = ResIgnoreAurasAb.begin(); j != ResIgnoreAurasAb.end(); ++j)
2016 {
2017 if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL
2018 && (*j)->IsAffectedOnSpell(spellInfo))
2019 armor = floor(AddPct(armor, -(*j)->GetAmount()));
2020 }
2021
2022 AuraEffectList const& ResIgnoreAuras = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST);
2023 for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j)
2024 {
2025 if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
2026 armor = floor(AddPct(armor, -(*j)->GetAmount()));
2027 }
2028
2029 // Apply Player CR_ARMOR_PENETRATION rating and buffs from stances\specializations etc.
2030 if (attacker->GetTypeId() == TYPEID_PLAYER)
2031 {
2032 float bonusPct = 0;
2033 AuraEffectList const& armorPenAuras = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT);
2034 for (AuraEffectList::const_iterator itr = armorPenAuras.begin(); itr != armorPenAuras.end(); ++itr)
2035 {
2036 if ((*itr)->GetSpellInfo()->EquippedItemClass == -1)
2037 {
2038 if (!spellInfo || (*itr)->IsAffectedOnSpell(spellInfo) || (*itr)->GetMiscValue() & spellInfo->GetSchoolMask())
2039 bonusPct += (*itr)->GetAmount();
2040 else if (!(*itr)->GetMiscValue() && !(*itr)->HasSpellClassMask())
2041 bonusPct += (*itr)->GetAmount();
2042 }
2043 else
2044 {
2045 if (attacker->ToPlayer()->HasItemFitToSpellRequirements((*itr)->GetSpellInfo()))
2046 bonusPct += (*itr)->GetAmount();
2047 }
2048 }
2049
2050 float maxArmorPen = 0;
2051 if (victim->GetLevel() < 60)
2052 maxArmorPen = float(400 + 85 * victim->GetLevel());
2053 else
2054 maxArmorPen = 400 + 85 * victim->GetLevel() + 4.5f * 85 * (victim->GetLevel() - 59);
2055
2056 // Cap armor penetration to this number
2057 maxArmorPen = std::min((armor + maxArmorPen) / 3, armor);
2058 // Figure out how much armor do we ignore
2059 float armorPen = CalculatePct(maxArmorPen, bonusPct + attacker->ToPlayer()->GetRatingBonusValue(CR_ARMOR_PENETRATION));
2060 // Got the value, apply it
2061 armor -= std::min(armorPen, maxArmorPen);
2062 }
2063 }
2064
2065 if (armor < 0.0f)
2066 armor = 0.0f;
2067
2068 float levelModifier = attacker ? attacker->GetLevel() : attackerLevel;
2069 if (levelModifier > 59)
2070 levelModifier = levelModifier + (4.5f * (levelModifier - 59));
2071
2072 float tmpvalue = 0.1f * armor / (8.5f * levelModifier + 40);
2073 tmpvalue = tmpvalue / (1.0f + tmpvalue);
2074
2075 if (tmpvalue < 0.0f)
2076 tmpvalue = 0.0f;
2077 if (tmpvalue > 0.75f)
2078 tmpvalue = 0.75f;
2079
2080 return uint32(std::ceil(std::max(damage * (1.0f - tmpvalue), 0.0f)));
2081}
@ CR_ARMOR_PENETRATION
Definition: Unit.h:428
@ SPELL_AURA_MOD_ARMOR_PENETRATION_PCT
Definition: SpellAuraDefines.h:343
@ SPELL_AURA_MOD_TARGET_RESISTANCE
Definition: SpellAuraDefines.h:186
@ SPELLMOD_IGNORE_ARMOR
Definition: SpellDefines.h:90

References AddPct(), CalculatePct(), CR_ARMOR_PENETRATION, GetArmor(), GetAuraEffectsByType(), GetLevel(), Player::GetRatingBonusValue(), SpellInfo::GetSchoolMask(), GetSpellModOwner(), GetTotalAuraModifierByMiscMask(), Object::GetTypeId(), Player::HasItemFitToSpellRequirements(), SpellInfo::Id, SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_ARMOR_PENETRATION_PCT, SPELL_AURA_MOD_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_TARGET_RESISTANCE, SPELL_SCHOOL_MASK_NORMAL, SPELLMOD_IGNORE_ARMOR, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by CalcAbsorbResist(), CalculateMeleeDamage(), CalculateSpellDamageTaken(), boss_priestess_lackey_commonAI::GetThreatMod(), boss_faction_championsAI::GetThreatMod(), AuraEffect::HandlePeriodicDamageAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ CalcHealAbsorb()

void Unit::CalcHealAbsorb ( HealInfo healInfo)
static
2465{
2466 if (!healInfo.GetHeal())
2467 return;
2468
2469 int32 const healing = static_cast<int32>(healInfo.GetHeal());
2470 int32 absorbAmount = 0;
2471
2472 // Need remove expired auras after
2473 bool existExpired = false;
2474
2475 // absorb without mana cost
2477 for (AuraEffectList::const_iterator i = vHealAbsorb.begin(); i != vHealAbsorb.end() && absorbAmount <= healing; ++i)
2478 {
2479 if (!((*i)->GetMiscValue() & healInfo.GetSpellInfo()->SchoolMask))
2480 continue;
2481
2482 // Max Amount can be absorbed by this aura
2483 int32 currentAbsorb = (*i)->GetAmount();
2484
2485 // Found empty aura (impossible but..)
2486 if (currentAbsorb <= 0)
2487 {
2488 existExpired = true;
2489 continue;
2490 }
2491
2492 // currentAbsorb - damage can be absorbed by shield
2493 // If need absorb less damage
2494 if (healing < currentAbsorb + absorbAmount)
2495 currentAbsorb = healing - absorbAmount;
2496
2497 absorbAmount += currentAbsorb;
2498
2499 // Reduce shield amount
2500 (*i)->SetAmount((*i)->GetAmount() - currentAbsorb);
2501 // Need remove it later
2502 if ((*i)->GetAmount() <= 0)
2503 existExpired = true;
2504 }
2505
2506 // Remove all expired absorb auras
2507 if (existExpired)
2508 {
2509 for (AuraEffectList::const_iterator i = vHealAbsorb.begin(); i != vHealAbsorb.end();)
2510 {
2511 AuraEffect* auraEff = *i;
2512 ++i;
2513 if (auraEff->GetAmount() <= 0)
2514 {
2515 uint32 removedAuras = healInfo.GetTarget()->m_removedAurasCount;
2517 if (removedAuras + 1 < healInfo.GetTarget()->m_removedAurasCount)
2518 i = vHealAbsorb.begin();
2519 }
2520 }
2521 }
2522
2523 if (absorbAmount > 0)
2524 healInfo.AbsorbHeal(absorbAmount);
2525}
@ SPELL_AURA_SCHOOL_HEAL_ABSORB
Definition: SpellAuraDefines.h:364
SpellInfo const * GetSpellInfo() const
Definition: Unit.h:834
void AbsorbHeal(uint32 amount)
Definition: Unit.h:818
Unit * GetTarget() const
Definition: Unit.h:831
uint32 GetHeal() const
Definition: Unit.h:832
uint32 SchoolMask
Definition: SpellInfo.h:390

References HealInfo::AbsorbHeal(), AURA_REMOVE_BY_ENEMY_SPELL, AuraEffect::GetAmount(), GetAuraEffectsByType(), AuraEffect::GetBase(), HealInfo::GetHeal(), HealInfo::GetSpellInfo(), HealInfo::GetTarget(), m_removedAurasCount, Aura::Remove(), SpellInfo::SchoolMask, and SPELL_AURA_SCHOOL_HEAL_ABSORB.

Referenced by AuraEffect::HandlePeriodicHealAurasTick(), and HealBySpell().

◆ CalcSpellDuration()

int32 Unit::CalcSpellDuration ( SpellInfo const *  spellProto)
14744{
14745 uint8 comboPoints = GetComboPoints();
14746
14747 int32 minduration = spellProto->GetDuration();
14748 int32 maxduration = spellProto->GetMaxDuration();
14749
14750 int32 duration;
14751
14752 if (comboPoints && minduration != -1 && minduration != maxduration)
14753 duration = minduration + int32((maxduration - minduration) * comboPoints / 5);
14754 else
14755 duration = minduration;
14756
14757 return duration;
14758}
uint8 GetComboPoints(Unit const *who=nullptr) const
--------—Combo point system----------------—
Definition: Unit.h:2290

References GetComboPoints(), SpellInfo::GetDuration(), and SpellInfo::GetMaxDuration().

Referenced by Aura::CalcMaxDuration(), Spell::EffectInterruptCast(), Spell::EffectSchoolDMG(), and Aura::HandleAuraSpecificMods().

◆ CalculateAOEDamageReduction()

int32 Unit::CalculateAOEDamageReduction ( int32  damage,
uint32  schoolMask,
Unit caster 
) const
20598{
20599 damage = int32(float(damage) * GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, schoolMask));
20600 if (caster && caster->GetTypeId() == TYPEID_UNIT)
20602
20603 return damage;
20604}
@ SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE
Definition: SpellAuraDefines.h:373
@ SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE
Definition: SpellAuraDefines.h:292
float GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition: Unit.cpp:5886

References GetTotalAuraMultiplierByMiscMask(), Object::GetTypeId(), SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE, and TYPEID_UNIT.

Referenced by Spell::DoAllEffectOnLaunchTarget(), AuraEffect::HandlePeriodicDamageAurasTick(), and spell_dk_death_and_decay::RecalculateDamage().

◆ CalculateDamage()

uint32 Unit::CalculateDamage ( WeaponAttackType  attType,
bool  normalized,
bool  addTotalPct,
uint8  itemDamagesMask = 0 
)
2947{
2948 float minDamage = 0.0f;
2949 float maxDamage = 0.0f;
2950
2951 if (normalized || !addTotalPct || itemDamagesMask)
2952 {
2953 // get both by default
2954 if (!itemDamagesMask)
2955 {
2956 itemDamagesMask = (1 << 0) | (1 << 1);
2957 }
2958
2959 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
2960 {
2961 if (itemDamagesMask & (1 << i))
2962 {
2963 float minTmp, maxTmp;
2964 CalculateMinMaxDamage(attType, normalized, addTotalPct, minTmp, maxTmp, i);
2965 minDamage += minTmp;
2966 maxDamage += maxTmp;
2967 }
2968 }
2969 }
2970 else
2971 {
2972 switch (attType)
2973 {
2974 case RANGED_ATTACK:
2977 break;
2978 case BASE_ATTACK:
2981 break;
2982 case OFF_ATTACK:
2985 break;
2986 default:
2987 break;
2988 }
2989 }
2990
2991 minDamage = std::max(0.f, minDamage);
2992 maxDamage = std::max(0.f, maxDamage);
2993
2994 if (minDamage > maxDamage)
2995 {
2996 std::swap(minDamage, maxDamage);
2997 }
2998
2999 return urand(uint32(minDamage), uint32(maxDamage));
3000}
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
@ UNIT_FIELD_MINDAMAGE
Definition: UpdateFields.h:127
@ UNIT_FIELD_MAXDAMAGE
Definition: UpdateFields.h:128
@ UNIT_FIELD_MAXOFFHANDDAMAGE
Definition: UpdateFields.h:130
@ UNIT_FIELD_MAXRANGEDDAMAGE
Definition: UpdateFields.h:169
@ UNIT_FIELD_MINRANGEDDAMAGE
Definition: UpdateFields.h:168
@ UNIT_FIELD_MINOFFHANDDAMAGE
Definition: UpdateFields.h:129
float GetFloatValue(uint16 index) const
Definition: Object.cpp:317
virtual void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage, uint8 damageIndex=0)=0

References BASE_ATTACK, CalculateMinMaxDamage(), Object::GetFloatValue(), MAX_ITEM_PROTO_DAMAGES, OFF_ATTACK, RANGED_ATTACK, UNIT_FIELD_MAXDAMAGE, UNIT_FIELD_MAXOFFHANDDAMAGE, UNIT_FIELD_MAXRANGEDDAMAGE, UNIT_FIELD_MINDAMAGE, UNIT_FIELD_MINOFFHANDDAMAGE, UNIT_FIELD_MINRANGEDDAMAGE, and urand().

Referenced by CalculateMeleeDamage(), and Spell::EffectWeaponDmg().

◆ CalculateDefaultCoefficient()

float Unit::CalculateDefaultCoefficient ( SpellInfo const *  spellInfo,
DamageEffectType  damagetype 
) const
17342{
17343 // Damage over Time spells bonus calculation
17344 float DotFactor = 1.0f;
17345 if (damagetype == DOT)
17346 {
17347 int32 DotDuration = spellInfo->GetDuration();
17348 if (!spellInfo->IsChanneled() && DotDuration > 0)
17349 DotFactor = DotDuration / 15000.0f;
17350
17351 if (uint32 DotTicks = spellInfo->GetMaxTicks())
17352 DotFactor /= DotTicks;
17353 }
17354
17355 int32 CastingTime = spellInfo->IsChanneled() ? spellInfo->GetDuration() : spellInfo->CalcCastTime();
17356 // Distribute Damage over multiple effects, reduce by AoE
17357 CastingTime = GetCastingTimeForBonus(spellInfo, damagetype, CastingTime);
17358
17359 // As wowwiki says: C = (Cast Time / 3.5)
17360 return (CastingTime / 3500.0f) * DotFactor;
17361}
@ DOT
Definition: Unit.h:437
uint32 GetCastingTimeForBonus(SpellInfo const *spellProto, DamageEffectType damagetype, uint32 CastingTime) const
Definition: Unit.cpp:17223

References SpellInfo::CalcCastTime(), DOT, GetCastingTimeForBonus(), SpellInfo::GetDuration(), SpellInfo::GetMaxTicks(), and SpellInfo::IsChanneled().

Referenced by SpellDamageBonusTaken().

◆ CalculateLevelPenalty()

float Unit::CalculateLevelPenalty ( SpellInfo const *  spellProto) const
3003{
3004 if (GetTypeId() != TYPEID_PLAYER)
3005 return 1.0f;
3006
3007 if (spellProto->SpellLevel <= 0 || spellProto->SpellLevel >= spellProto->MaxLevel)
3008 return 1.0f;
3009
3010 float LvlPenalty = 0.0f;
3011
3012 // xinef: added brackets
3013 if (spellProto->SpellLevel < 20)
3014 LvlPenalty = (20.0f - spellProto->SpellLevel) * 3.75f;
3015
3016 float LvlFactor = (float(spellProto->SpellLevel) + 6.0f) / float(GetLevel());
3017 if (LvlFactor > 1.0f)
3018 LvlFactor = 1.0f;
3019
3020 return AddPct(LvlFactor, -LvlPenalty);
3021}
uint8 GetLevel() const
Definition: Unit.h:1420

References AddPct(), GetLevel(), Object::GetTypeId(), SpellInfo::MaxLevel, SpellInfo::SpellLevel, and TYPEID_PLAYER.

Referenced by spell_mage_ice_barrier_aura::CalculateSpellAmount(), spell_mage_ice_barrier::CalculateSpellAmount(), CalculateSpellAmount(), SpellDamageBonusDone(), SpellDamageBonusTaken(), and SpellHealingBonusDone().

◆ CalculateMeleeDamage()

void Unit::CalculateMeleeDamage ( Unit victim,
CalcDamageInfo damageInfo,
WeaponAttackType  attackType = BASE_ATTACK,
const bool  sittingVictim = false 
)
1462{
1463 damageInfo->attacker = this;
1464 damageInfo->target = victim;
1465
1466 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1467 {
1468 damageInfo->damages[i].damageSchoolMask = GetMeleeDamageSchoolMask(attackType, i);
1469 damageInfo->damages[i].damage = 0;
1470 damageInfo->damages[i].absorb = 0;
1471 damageInfo->damages[i].resist = 0;
1472 }
1473
1474 damageInfo->attackType = attackType;
1475 damageInfo->cleanDamage = 0;
1476 damageInfo->blocked_amount = 0;
1477
1478 damageInfo->TargetState = 0;
1479 damageInfo->HitInfo = 0;
1480 damageInfo->procAttacker = PROC_FLAG_NONE;
1481 damageInfo->procVictim = PROC_FLAG_NONE;
1482 damageInfo->procEx = PROC_EX_NONE;
1483 damageInfo->hitOutCome = MELEE_HIT_EVADE;
1484
1485 if (!victim)
1486 return;
1487
1488 if (!IsAlive() || !victim->IsAlive())
1489 return;
1490
1491 // Select HitInfo/procAttacker/procVictim flag based on attack type
1492 switch (attackType)
1493 {
1494 case BASE_ATTACK:
1497 break;
1498 case OFF_ATTACK:
1501 damageInfo->HitInfo = HITINFO_OFFHAND;
1502 break;
1503 default:
1504 return;
1505 }
1506
1507 // School Immune check
1508 uint8 immunedMask = 0;
1509 bool hasNonPhysicalSchoolMask = false;
1510 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1511 {
1513 {
1514 immunedMask |= (1 << i);
1516 {
1517 hasNonPhysicalSchoolMask = true;
1518 }
1519 }
1520 }
1521
1522 // School Immune check
1523 if (immunedMask & ((1 << 0) | (1 << 1)))
1524 {
1525 if (hasNonPhysicalSchoolMask || immunedMask == ((1 << 0) | (1 << 1)))
1526 {
1527 damageInfo->HitInfo |= HITINFO_NORMALSWING;
1528 damageInfo->TargetState = VICTIMSTATE_IS_IMMUNE;
1529
1530 damageInfo->procEx |= PROC_EX_IMMUNE;
1531 return;
1532 }
1533 }
1534
1535 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1536 {
1537 // only players have secondary weapon damage
1538 if (i > 0 && GetTypeId() != TYPEID_PLAYER)
1539 {
1540 break;
1541 }
1542
1543 if (immunedMask & (1 << i))
1544 {
1545 continue;
1546 }
1547
1548 SpellSchoolMask schoolMask = SpellSchoolMask(damageInfo->damages[i].damageSchoolMask);
1549 bool const addPctMods = (schoolMask & SPELL_SCHOOL_MASK_NORMAL);
1550
1551 uint32 damage = 0;
1552 uint8 itemDamagesMask = (GetTypeId() == TYPEID_PLAYER) ? (1 << i) : 0;
1553
1554 damage += CalculateDamage(damageInfo->attackType, false, addPctMods, itemDamagesMask);
1555 // Add melee damage bonus
1556 damage = MeleeDamageBonusDone(damageInfo->target, damage, damageInfo->attackType, nullptr, schoolMask);
1557 damage = damageInfo->target->MeleeDamageBonusTaken(this, damage, damageInfo->attackType, nullptr, schoolMask);
1558
1559 // Script Hook For CalculateMeleeDamage -- Allow scripts to change the Damage pre class mitigation calculations
1560 sScriptMgr->ModifyMeleeDamage(damageInfo->target, damageInfo->attacker, damage);
1561
1562 // Calculate armor reduction
1564 {
1565 damageInfo->damages[i].damage = Unit::CalcArmorReducedDamage(this, damageInfo->target, damage, nullptr, 0, damageInfo->attackType);
1566 damageInfo->cleanDamage += damage - damageInfo->damages[i].damage;
1567 }
1568 else
1569 {
1570 damageInfo->damages[i].damage = damage;
1571 }
1572 }
1573
1574 damageInfo->hitOutCome = RollMeleeOutcomeAgainst(damageInfo->target, damageInfo->attackType);
1575
1576 // If the victim was a sitting player and we didn't roll a miss, then crit.
1577 if (sittingVictim && damageInfo->hitOutCome != MELEE_HIT_MISS)
1578 {
1579 damageInfo->hitOutCome = MELEE_HIT_CRIT;
1580 }
1581 switch (damageInfo->hitOutCome)
1582 {
1583 case MELEE_HIT_EVADE:
1585 damageInfo->TargetState = VICTIMSTATE_EVADES;
1586 damageInfo->procEx |= PROC_EX_EVADE;
1587
1588 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1589 {
1590 damageInfo->damages[i].damage = 0;
1591 }
1592
1593 damageInfo->cleanDamage = 0;
1594 return;
1595 case MELEE_HIT_MISS:
1596 damageInfo->HitInfo |= HITINFO_MISS;
1597 damageInfo->TargetState = VICTIMSTATE_INTACT;
1598 damageInfo->procEx |= PROC_EX_MISS;
1599
1600 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1601 {
1602 damageInfo->damages[i].damage = 0;
1603 }
1604 damageInfo->cleanDamage = 0;
1605 break;
1606 case MELEE_HIT_NORMAL:
1607 damageInfo->TargetState = VICTIMSTATE_HIT;
1608 damageInfo->procEx |= PROC_EX_NORMAL_HIT;
1609 break;
1610 case MELEE_HIT_CRIT:
1611 {
1612 damageInfo->HitInfo |= HITINFO_CRITICALHIT;
1613 damageInfo->TargetState = VICTIMSTATE_HIT;
1614
1615 damageInfo->procEx |= PROC_EX_CRITICAL_HIT;
1616 // Crit bonus calc
1617 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1618 {
1619 damageInfo->damages[i].damage *= 2;
1620
1621 float mod = 0.0f;
1622 // Apply SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE or SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE
1623 if (damageInfo->attackType == RANGED_ATTACK)
1624 {
1626 }
1627 else
1628 {
1630
1631 // Increase crit damage from SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
1633 }
1634
1635 uint32 crTypeMask = damageInfo->target->GetCreatureTypeMask();
1636
1637 // Increase crit damage from SPELL_AURA_MOD_CRIT_PERCENT_VERSUS
1639 if (mod != 0)
1640 {
1641 AddPct(damageInfo->damages[i].damage, mod);
1642 }
1643 }
1644 break;
1645 }
1646 case MELEE_HIT_PARRY:
1647 damageInfo->TargetState = VICTIMSTATE_PARRY;
1648 damageInfo->procEx |= PROC_EX_PARRY;
1649 damageInfo->cleanDamage = 0;
1650
1651 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1652 {
1653 damageInfo->cleanDamage += damageInfo->damages[i].damage;
1654 damageInfo->damages[i].damage = 0;
1655 }
1656 break;
1657 case MELEE_HIT_DODGE:
1658 damageInfo->TargetState = VICTIMSTATE_DODGE;
1659 damageInfo->procEx |= PROC_EX_DODGE;
1660 damageInfo->cleanDamage = 0;
1661
1662 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1663 {
1664 damageInfo->cleanDamage += damageInfo->damages[i].damage;
1665 damageInfo->damages[i].damage = 0;
1666 }
1667 break;
1668 case MELEE_HIT_BLOCK:
1669 {
1670 damageInfo->TargetState = VICTIMSTATE_HIT;
1671 damageInfo->HitInfo |= HITINFO_BLOCK;
1672 damageInfo->procEx |= PROC_EX_BLOCK;
1673 damageInfo->blocked_amount = damageInfo->target->GetShieldBlockValue();
1674 // double blocked amount if block is critical
1675 if (damageInfo->target->isBlockCritical())
1676 damageInfo->blocked_amount += damageInfo->blocked_amount;
1677
1678 uint32 remainingBlock = damageInfo->blocked_amount;
1679 uint8 fullBlockMask = 0;
1680 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1681 {
1682 if (remainingBlock && remainingBlock >= damageInfo->damages[i].damage)
1683 {
1684 fullBlockMask |= (1 << i);
1685
1686 remainingBlock -= damageInfo->damages[i].damage;
1687 damageInfo->cleanDamage += damageInfo->damages[i].damage;
1688 damageInfo->damages[i].damage = 0;
1689 }
1690 else
1691 {
1692 damageInfo->cleanDamage += remainingBlock;
1693 damageInfo->damages[i].damage -= remainingBlock;
1694 remainingBlock = 0;
1695 }
1696 }
1697
1698 // full block
1699 if (fullBlockMask == ((1 << 0) | (1 << 1)))
1700 {
1701 damageInfo->TargetState = VICTIMSTATE_BLOCKS;
1702 damageInfo->procEx |= PROC_EX_FULL_BLOCK;
1703 damageInfo->blocked_amount -= remainingBlock;
1704 }
1705 break;
1706 }
1707 case MELEE_HIT_GLANCING:
1708 {
1709 damageInfo->HitInfo |= HITINFO_GLANCING;
1710 damageInfo->TargetState = VICTIMSTATE_HIT;
1711 damageInfo->procEx |= PROC_EX_NORMAL_HIT;
1712 int32 leveldif = int32(victim->GetLevel()) - int32(GetLevel());
1713 if (leveldif > 3)
1714 leveldif = 3;
1715 float reducePercent = 1 - leveldif * 0.1f;
1716
1717 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1718 {
1719 uint32 reducedDamage = uint32(reducePercent * damageInfo->damages[i].damage);
1720 damageInfo->cleanDamage += damageInfo->damages[i].damage - reducedDamage;
1721 damageInfo->damages[i].damage = reducedDamage;
1722 }
1723 break;
1724 }
1725 case MELEE_HIT_CRUSHING:
1726 damageInfo->HitInfo |= HITINFO_CRUSHING;
1727 damageInfo->TargetState = VICTIMSTATE_HIT;
1728 damageInfo->procEx |= PROC_EX_NORMAL_HIT;
1729
1730 // 150% normal damage
1731 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1732 {
1733 damageInfo->damages[i].damage += (damageInfo->damages[i].damage / 2);
1734 }
1735 break;
1736 default:
1737 break;
1738 }
1739
1740 // Always apply HITINFO_AFFECTS_VICTIM in case its not a miss
1741 if (!(damageInfo->HitInfo & HITINFO_MISS))
1742 damageInfo->HitInfo |= HITINFO_AFFECTS_VICTIM;
1743
1744 uint32 tmpHitInfo[MAX_ITEM_PROTO_DAMAGES] = { };
1745
1746 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1747 {
1748 int32 dmg = damageInfo->damages[i].damage;
1749 int32 cleanDamage = damageInfo->cleanDamage;
1750 // attackType is checked already for BASE_ATTACK or OFF_ATTACK so it can't be RANGED_ATTACK here
1751 if (CanApplyResilience())
1752 {
1753 int32 resilienceReduction = damageInfo->damages[i].damage;
1754 Unit::ApplyResilience(victim, nullptr, &resilienceReduction, (damageInfo->hitOutCome == MELEE_HIT_CRIT), CR_CRIT_TAKEN_MELEE);
1755
1756 resilienceReduction = damageInfo->damages[i].damage - resilienceReduction;
1757 dmg -= resilienceReduction;
1758 cleanDamage += resilienceReduction;
1759 }
1760
1761 damageInfo->damages[i].damage = std::max(0, dmg);
1762 damageInfo->cleanDamage = std::max(0, cleanDamage);
1763
1764 // Calculate absorb resist
1765 if (damageInfo->damages[i].damage > 0)
1766 {
1767 damageInfo->procVictim |= PROC_FLAG_TAKEN_DAMAGE;
1768
1769 // Calculate absorb & resists
1770 DamageInfo dmgInfo(*damageInfo, i);
1771 Unit::CalcAbsorbResist(dmgInfo);
1772 damageInfo->damages[i].absorb = dmgInfo.GetAbsorb();
1773 damageInfo->damages[i].resist = dmgInfo.GetResist();
1774
1775 if (damageInfo->damages[i].absorb)
1776 {
1777 tmpHitInfo[i] |= (damageInfo->damages[i].damage - damageInfo->damages[i].absorb == 0 ? HITINFO_FULL_ABSORB : HITINFO_PARTIAL_ABSORB);
1778 }
1779
1780 if (damageInfo->damages[i].resist)
1781 {
1782 tmpHitInfo[i] |= (damageInfo->damages[i].damage - damageInfo->damages[i].resist == 0 ? HITINFO_FULL_RESIST : HITINFO_PARTIAL_RESIST);
1783 }
1784
1785 damageInfo->damages[i].damage = dmgInfo.GetDamage();
1786 }
1787 }
1788
1789 // set proper HitInfo flags
1790 if ((tmpHitInfo[0] & HITINFO_FULL_ABSORB) != 0)
1791 {
1792 // set partial absorb when secondary damage isn't full absorbed
1793 damageInfo->HitInfo |= ((tmpHitInfo[1] & HITINFO_PARTIAL_ABSORB) != 0) ? HITINFO_PARTIAL_ABSORB : HITINFO_FULL_ABSORB;
1794 }
1795 else
1796 {
1797 damageInfo->HitInfo |= (tmpHitInfo[0] & HITINFO_PARTIAL_ABSORB);
1798 }
1799
1800 if ((tmpHitInfo[0] & HITINFO_FULL_RESIST) != 0)
1801 {
1802 // set partial resist when secondary damage isn't full resisted
1803 damageInfo->HitInfo |= ((tmpHitInfo[1] & HITINFO_PARTIAL_RESIST) != 0) ? HITINFO_PARTIAL_RESIST : HITINFO_FULL_RESIST;
1804 }
1805 else
1806 {
1807 damageInfo->HitInfo |= (tmpHitInfo[0] & HITINFO_PARTIAL_RESIST);
1808 }
1809
1811 {
1812 damageInfo->procEx |= PROC_EX_ABSORB;
1813 }
1814
1815 if (damageInfo->HitInfo & HITINFO_FULL_RESIST)
1816 {
1817 damageInfo->procEx |= PROC_EX_RESIST;
1818 }
1819}
@ VICTIMSTATE_INTACT
Definition: Unit.h:166
@ VICTIMSTATE_HIT
Definition: Unit.h:167
@ VICTIMSTATE_DODGE
Definition: Unit.h:168
@ VICTIMSTATE_IS_IMMUNE
Definition: Unit.h:173
@ VICTIMSTATE_PARRY
Definition: Unit.h:169
@ VICTIMSTATE_BLOCKS
Definition: Unit.h:171
@ VICTIMSTATE_EVADES
Definition: Unit.h:172
@ HITINFO_PARTIAL_ABSORB
Definition: Unit.h:186
@ HITINFO_FULL_RESIST
Definition: Unit.h:187
@ HITINFO_NORMALSWING
Definition: Unit.h:179
@ HITINFO_BLOCK
Definition: Unit.h:193
@ HITINFO_CRUSHING
Definition: Unit.h:197
@ HITINFO_SWINGNOHITSOUND
Definition: Unit.h:201
@ HITINFO_MISS
Definition: Unit.h:184
@ HITINFO_FULL_ABSORB
Definition: Unit.h:185
@ HITINFO_OFFHAND
Definition: Unit.h:182
@ HITINFO_GLANCING
Definition: Unit.h:196
@ HITINFO_CRITICALHIT
Definition: Unit.h:189
@ HITINFO_PARTIAL_RESIST
Definition: Unit.h:188
@ HITINFO_AFFECTS_VICTIM
Definition: Unit.h:181
@ MELEE_HIT_CRUSHING
Definition: Unit.h:717
@ MELEE_HIT_BLOCK
Definition: Unit.h:716
@ MELEE_HIT_CRIT
Definition: Unit.h:717
@ MELEE_HIT_EVADE
Definition: Unit.h:716
@ MELEE_HIT_DODGE
Definition: Unit.h:716
@ MELEE_HIT_MISS
Definition: Unit.h:716
@ MELEE_HIT_PARRY
Definition: Unit.h:716
@ MELEE_HIT_GLANCING
Definition: Unit.h:717
@ SPELL_AURA_MOD_CRIT_PERCENT_VERSUS
Definition: SpellAuraDefines.h:232
@ SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE
Definition: SpellAuraDefines.h:267
@ SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
Definition: SpellAuraDefines.h:226
@ SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE
Definition: SpellAuraDefines.h:266
@ PROC_EX_NONE
Definition: SpellMgr.h:193
@ PROC_EX_DODGE
Definition: SpellMgr.h:198
@ PROC_EX_BLOCK
Definition: SpellMgr.h:200
@ PROC_EX_CRITICAL_HIT
Definition: SpellMgr.h:195
@ PROC_EX_MISS
Definition: SpellMgr.h:196
@ PROC_EX_RESIST
Definition: SpellMgr.h:197
@ PROC_EX_FULL_BLOCK
Definition: SpellMgr.h:207
@ PROC_EX_ABSORB
Definition: SpellMgr.h:204
@ PROC_EX_PARRY
Definition: SpellMgr.h:199
@ PROC_EX_EVADE
Definition: SpellMgr.h:201
@ PROC_FLAG_DONE_MELEE_AUTO_ATTACK
Definition: SpellMgr.h:110
@ PROC_FLAG_DONE_MAINHAND_ATTACK
Definition: SpellMgr.h:140
@ PROC_FLAG_TAKEN_DAMAGE
Definition: SpellMgr.h:137
@ PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK
Definition: SpellMgr.h:111
@ PROC_FLAG_DONE_OFFHAND_ATTACK
Definition: SpellMgr.h:141
@ PROC_FLAG_NONE
Definition: SpellMgr.h:105
uint32 damageSchoolMask
Definition: Unit.h:888
uint32 blocked_amount
Definition: Unit.h:894
MeleeHitOutcome hitOutCome
Definition: Unit.h:903
uint32 cleanDamage
Definition: Unit.h:902
uint32 TargetState
Definition: Unit.h:896
uint32 resist
Definition: Unit.h:891
uint32 HitInfo
Definition: Unit.h:895
bool isBlockCritical()
Definition: Unit.cpp:3080
uint32 MeleeDamageBonusTaken(Unit *attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
Definition: Unit.cpp:13192
virtual SpellSchoolMask GetMeleeDamageSchoolMask(WeaponAttackType attackType=BASE_ATTACK, uint8 damageIndex=0) const =0
int32 GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition: Unit.cpp:5873
bool CanApplyResilience() const
Definition: Unit.h:2427
uint32 CalculateDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, uint8 itemDamagesMask=0)
Definition: Unit.cpp:2946
virtual uint32 GetShieldBlockValue() const =0
static void ApplyResilience(Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
Definition: Unit.cpp:19065
static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr, uint8 effIndex=MAX_SPELL_EFFECTS)
Definition: Unit.cpp:1978
int32 GetTotalAuraModifier(AuraType auratype) const
Definition: Unit.cpp:5822
MeleeHitOutcome RollMeleeOutcomeAgainst(Unit const *victim, WeaponAttackType attType) const
Definition: Unit.cpp:2743
uint32 GetCreatureTypeMask() const
Definition: Unit.h:1528
uint32 MeleeDamageBonusDone(Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
Definition: Unit.cpp:12990

References CalcDamageInfo::absorb, AddPct(), CalcDamageInfo::attacker, CalcDamageInfo::attackType, BASE_ATTACK, CalcDamageInfo::blocked_amount, CalcArmorReducedDamage(), CalculateDamage(), CalcDamageInfo::cleanDamage, CalcDamageInfo::damage, CalcDamageInfo::damages, CalcDamageInfo::damageSchoolMask, GetCreatureTypeMask(), GetLevel(), GetMeleeDamageSchoolMask(), GetShieldBlockValue(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), GetTotalAuraMultiplierByMiscMask(), Object::GetTypeId(), CalcDamageInfo::HitInfo, HITINFO_AFFECTS_VICTIM, HITINFO_BLOCK, HITINFO_CRITICALHIT, HITINFO_CRUSHING, HITINFO_GLANCING, HITINFO_MISS, HITINFO_NORMALSWING, HITINFO_OFFHAND, HITINFO_SWINGNOHITSOUND, CalcDamageInfo::hitOutCome, IsAlive(), isBlockCritical(), IsDamageReducedByArmor(), IsImmunedToDamageOrSchool(), MAX_ITEM_PROTO_DAMAGES, MELEE_HIT_BLOCK, MELEE_HIT_CRIT, MELEE_HIT_CRUSHING, MELEE_HIT_DODGE, MELEE_HIT_EVADE, MELEE_HIT_GLANCING, MELEE_HIT_MISS, MELEE_HIT_NORMAL, MELEE_HIT_PARRY, MeleeDamageBonusDone(), MeleeDamageBonusTaken(), OFF_ATTACK, PROC_EX_BLOCK, PROC_EX_CRITICAL_HIT, PROC_EX_DODGE, PROC_EX_EVADE, PROC_EX_FULL_BLOCK, PROC_EX_IMMUNE, PROC_EX_MISS, PROC_EX_NONE, PROC_EX_NORMAL_HIT, PROC_EX_PARRY, PROC_FLAG_DONE_MAINHAND_ATTACK, PROC_FLAG_DONE_MELEE_AUTO_ATTACK, PROC_FLAG_DONE_OFFHAND_ATTACK, PROC_FLAG_NONE, PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK, CalcDamageInfo::procAttacker, CalcDamageInfo::procEx, CalcDamageInfo::procVictim, RANGED_ATTACK, CalcDamageInfo::resist, RollMeleeOutcomeAgainst(), SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE, SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, SPELL_SCHOOL_MASK_NORMAL, sScriptMgr, CalcDamageInfo::target, CalcDamageInfo::TargetState, TYPEID_PLAYER, VICTIMSTATE_BLOCKS, VICTIMSTATE_DODGE, VICTIMSTATE_EVADES, VICTIMSTATE_HIT, VICTIMSTATE_INTACT, VICTIMSTATE_IS_IMMUNE, and VICTIMSTATE_PARRY.

Referenced by AttackerStateUpdate(), and spell_dk_dancing_rune_weapon::HandleProc().

◆ CalculateMinMaxDamage()

virtual void Unit::CalculateMinMaxDamage ( WeaponAttackType  attType,
bool  normalized,
bool  addTotalPct,
float &  minDamage,
float &  maxDamage,
uint8  damageIndex = 0 
)
pure virtual

Implemented in Creature, and Player.

Referenced by CalculateDamage(), and UpdateDamagePhysical().

◆ CalculateSpellDamage()

int32 Unit::CalculateSpellDamage ( Unit const *  target,
SpellInfo const *  spellProto,
uint8  effect_index,
int32 const *  basePoints = nullptr 
) const

◆ CalculateSpellDamageTaken()

void Unit::CalculateSpellDamageTaken ( SpellNonMeleeDamage damageInfo,
int32  damage,
SpellInfo const *  spellInfo,
WeaponAttackType  attackType = BASE_ATTACK,
bool  crit = false 
)
1298{
1299 if (damage < 0)
1300 return;
1301
1302 Unit* victim = damageInfo->target;
1303 if (!victim || !victim->IsAlive())
1304 return;
1305
1306 SpellSchoolMask damageSchoolMask = SpellSchoolMask(damageInfo->schoolMask);
1307 uint32 crTypeMask = victim->GetCreatureTypeMask();
1308
1309 // Script Hook For CalculateSpellDamageTaken -- Allow scripts to change the Damage post class mitigation calculations
1310 sScriptMgr->ModifySpellDamageTaken(damageInfo->target, damageInfo->attacker, damage, spellInfo);
1311
1312 int32 cleanDamage = 0;
1313 if (Unit::IsDamageReducedByArmor(damageSchoolMask, spellInfo))
1314 {
1315 int32 oldDamage = damage;
1316 damage = Unit::CalcArmorReducedDamage(this, victim, damage, spellInfo, 0, attackType);
1317 cleanDamage = oldDamage - damage;
1318 }
1319
1320 bool blocked = false;
1321 // Per-school calc
1322 switch (spellInfo->DmgClass)
1323 {
1324 // Melee and Ranged Spells
1327 {
1328 // Physical Damage
1329 if (damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL)
1330 {
1331 // Get blocked status
1332 blocked = isSpellBlocked(victim, spellInfo, attackType);
1333 }
1334
1335 if (crit)
1336 {
1337 damageInfo->HitInfo |= SPELL_HIT_TYPE_CRIT;
1338
1339 // Calculate crit bonus
1340 uint32 crit_bonus = damage;
1341 // Apply crit_damage bonus for melee spells
1342 if (Player* modOwner = GetSpellModOwner())
1343 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
1344 damage += crit_bonus;
1345
1346 // Apply SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE or SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE
1347 float critPctDamageMod = 0.0f;
1348 if (attackType == RANGED_ATTACK)
1350 else
1352
1353 // Increase crit damage from SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
1354 critPctDamageMod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, spellInfo->GetSchoolMask());
1355
1356 // Increase crit damage from SPELL_AURA_MOD_CRIT_PERCENT_VERSUS
1358
1359 if (critPctDamageMod != 0)
1360 AddPct(damage, critPctDamageMod);
1361 }
1362
1363 // Spell weapon based damage CAN BE crit & blocked at same time
1364 if (blocked)
1365 {
1366 damageInfo->blocked = victim->GetShieldBlockValue();
1367 // double blocked amount if block is critical
1368 if (victim->isBlockCritical())
1369 damageInfo->blocked *= 2;
1370 if (damage < int32(damageInfo->blocked))
1371 damageInfo->blocked = uint32(damage);
1372
1373 damage -= damageInfo->blocked;
1374 cleanDamage += damageInfo->blocked;
1375 }
1376
1377 int32 resilienceReduction = damage;
1378 if (CanApplyResilience())
1379 {
1380 if (attackType != RANGED_ATTACK)
1381 {
1382 Unit::ApplyResilience(victim, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_MELEE);
1383 }
1384 else
1385 {
1386 Unit::ApplyResilience(victim, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_RANGED);
1387 }
1388 }
1389
1390 resilienceReduction = damage - resilienceReduction;
1391 damage -= resilienceReduction;
1392 cleanDamage += resilienceReduction;
1393 break;
1394 }
1395 // Magical Attacks
1398 {
1399 // If crit add critical bonus
1400 if (crit)
1401 {
1402 damageInfo->HitInfo |= SPELL_HIT_TYPE_CRIT;
1403 damage = Unit::SpellCriticalDamageBonus(this, spellInfo, damage, victim);
1404 }
1405
1406 int32 resilienceReduction = damage;
1407 if (CanApplyResilience())
1408 {
1409 Unit::ApplyResilience(victim, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_SPELL);
1410 }
1411
1412 resilienceReduction = damage - resilienceReduction;
1413 damage -= resilienceReduction;
1414 cleanDamage += resilienceReduction;
1415 break;
1416 }
1417 default:
1418 break;
1419 }
1420
1421 damageInfo->cleanDamage = std::max(0, cleanDamage);
1422 damageInfo->damage = std::max(0, damage);
1423
1424 // Calculate absorb resist
1425 if (damageInfo->damage > 0)
1426 {
1427 DamageInfo dmgInfo(*damageInfo, SPELL_DIRECT_DAMAGE);
1428 Unit::CalcAbsorbResist(dmgInfo);
1429 damageInfo->absorb = dmgInfo.GetAbsorb();
1430 damageInfo->resist = dmgInfo.GetResist();
1431 damageInfo->damage = dmgInfo.GetDamage();
1432 }
1433}
@ SPELL_DIRECT_DAMAGE
Definition: Unit.h:436
@ SPELLMOD_CRIT_DAMAGE_BONUS
Definition: SpellDefines.h:92
@ SPELL_DAMAGE_CLASS_RANGED
Definition: SharedDefines.h:1520
@ SPELL_DAMAGE_CLASS_MAGIC
Definition: SharedDefines.h:1518
@ SPELL_DAMAGE_CLASS_NONE
Definition: SharedDefines.h:1517
@ SPELL_DAMAGE_CLASS_MELEE
Definition: SharedDefines.h:1519
@ SPELL_HIT_TYPE_CRIT
Definition: SharedDefines.h:1508
Unit * target
Definition: Unit.h:914
uint32 HitInfo
Definition: Unit.h:925
uint32 damage
Definition: Unit.h:917
uint32 absorb
Definition: Unit.h:920
Unit * attacker
Definition: Unit.h:915
uint32 schoolMask
Definition: Unit.h:919
uint32 cleanDamage
Definition: Unit.h:927
uint32 resist
Definition: Unit.h:921
uint32 blocked
Definition: Unit.h:924
bool isSpellBlocked(Unit *victim, SpellInfo const *spellProto, WeaponAttackType attackType=BASE_ATTACK)
Definition: Unit.cpp:3054
static uint32 SpellCriticalDamageBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
Definition: Unit.cpp:12204

References SpellNonMeleeDamage::absorb, AddPct(), ApplyResilience(), SpellNonMeleeDamage::attacker, SpellNonMeleeDamage::blocked, CalcAbsorbResist(), CalcArmorReducedDamage(), CanApplyResilience(), SpellNonMeleeDamage::cleanDamage, CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, CR_CRIT_TAKEN_SPELL, SpellNonMeleeDamage::damage, SpellInfo::DmgClass, DamageInfo::GetAbsorb(), GetCreatureTypeMask(), DamageInfo::GetDamage(), DamageInfo::GetResist(), SpellInfo::GetSchoolMask(), GetShieldBlockValue(), GetSpellModOwner(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), SpellNonMeleeDamage::HitInfo, SpellInfo::Id, IsAlive(), isBlockCritical(), IsDamageReducedByArmor(), isSpellBlocked(), RANGED_ATTACK, SpellNonMeleeDamage::resist, SpellNonMeleeDamage::schoolMask, SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE, SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELL_DIRECT_DAMAGE, SPELL_HIT_TYPE_CRIT, SPELL_SCHOOL_MASK_NORMAL, SpellCriticalDamageBonus(), SPELLMOD_CRIT_DAMAGE_BONUS, sScriptMgr, and SpellNonMeleeDamage::target.

Referenced by Spell::DoAllEffectOnTarget(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), and AuraEffect::HandleProcTriggerDamageAuraProc().

◆ CanApplyResilience()

◆ CanDualWield()

◆ CanEnterWater()

virtual bool Unit::CanEnterWater ( ) const
pure virtual

Implemented in Creature, and Player.

◆ CanFly()

◆ CanFreeMove()

bool Unit::CanFreeMove ( ) const
inline
1402 {
1405 }
@ UNIT_STATE_DISTRACTED
Definition: Unit.h:337
@ UNIT_STATE_CONFUSED
Definition: Unit.h:336
@ UNIT_STATE_FLEEING
Definition: Unit.h:332
@ UNIT_STATE_IN_FLIGHT
Definition: Unit.h:333
@ UNIT_STATE_STUNNED
Definition: Unit.h:328

References GetOwnerGUID(), HasUnitState(), UNIT_STATE_CONFUSED, UNIT_STATE_DISTRACTED, UNIT_STATE_FLEEING, UNIT_STATE_IN_FLIGHT, UNIT_STATE_ROOT, and UNIT_STATE_STUNNED.

Referenced by SpellInfo::CheckTarget(), and Creature::IsFreeToMove().

◆ CanHaveThreatList()

bool Unit::CanHaveThreatList ( ) const
14505{
14506 // only creatures can have threat list
14507 if (GetTypeId() != TYPEID_UNIT)
14508 return false;
14509
14510 // only alive units can have threat list
14511 if (!IsAlive() || isDying())
14512 return false;
14513
14514 // totems can not have threat list
14515 if (ToCreature()->IsTotem())
14516 return false;
14517
14518 // vehicles can not have threat list
14519 if (ToCreature()->IsVehicle() && GetMap()->IsBattlegroundOrArena())
14520 return false;
14521
14522 // summons can not have a threat list, unless they are controlled by a creature
14524 return false;
14525
14526 return true;
14527}
@ UNIT_MASK_CONTROLABLE_GUARDIAN
Definition: Unit.h:683
@ UNIT_MASK_GUARDIAN
Definition: Unit.h:677
bool IsPlayer() const
Definition: Object.h:194
Map * GetMap() const
Definition: Object.h:517
bool IsVehicle() const
Definition: Unit.h:1416
bool isDying() const
Definition: Unit.h:1809

References WorldObject::GetMap(), GetOwnerGUID(), Object::GetTypeId(), HasUnitTypeMask(), IsAlive(), isDying(), Object::IsPlayer(), IsTotem(), IsVehicle(), Object::ToCreature(), TYPEID_UNIT, UNIT_MASK_CONTROLABLE_GUARDIAN, UNIT_MASK_GUARDIAN, and UNIT_MASK_MINION.

Referenced by AddThreat(), Creature::CanPeriodicallyCallForAssistance(), ThreatMgr::ClearAllThreat(), DealDamage(), ScriptedAI::DoResetThreatList(), CreatureAI::DoZoneInCombat(), Spell::EffectTaunt(), Spell::EffectThreat(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleModTaunt(), Spell::HandleThreatSpells(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), Creature::SelectVictim(), TauntApply(), TauntFadeOut(), and Update().

◆ CanInstantCast()

bool Unit::CanInstantCast ( ) const
inline
2437{ return _instantCast; }

References _instantCast.

Referenced by ModSpellCastTime().

◆ CanModifyStats()

◆ CanProc()

bool Unit::CanProc ( )
inline
2320{return !m_procDeep;}

References m_procDeep.

Referenced by Spell::DoAllEffectOnTarget().

◆ CanRestoreMana()

bool Unit::CanRestoreMana ( SpellInfo const *  spellInfo) const
21342{
21343 // Aura of Despair exceptions
21344 switch (spellInfo->Id)
21345 {
21346 case 30824: // Shamanistic Rage
21347 case 31786: // Spiritual Attunement
21348 case 31930: // Judgements of the Wise
21349 case 34075: // Aspect of the Viper
21350 case 34720: // Thrill of the hunt
21351 case 47755: // Rapture
21352 case 63337: // Saronite Vapors (regenerate mana)
21353 case 63375: // Improved stormstrike
21354 case 64372: // Lifebloom
21355 return true;
21356 case 54428: // Divine Plea - only with talent Guarded by the Light
21357 return HasSpell(53583);
21358 default:
21359 break;
21360 }
21361
21362 return false;
21363}
virtual bool HasSpell(uint32) const
Definition: Unit.h:1702

References HasSpell(), and SpellInfo::Id.

Referenced by IsImmunedToSpellEffect().

◆ CanSwim()

bool Unit::CanSwim ( ) const
virtual

this method checks the current flag of a unit

These flags can be set within the database or dynamically changed at runtime UNIT_FLAG_SWIMMING must be updated when a unit enters a swimmable area

Reimplemented in Creature.

20093{
20094 // Mirror client behavior, if this method returns false then client will not use swimming animation and for players will apply gravity as if there was no water
20096 return false;
20097 if (HasUnitFlag(UNIT_FLAG_POSSESSED)) // is player
20098 return true;
20100 return false;
20102 return true;
20104}
@ UNIT_FLAG2_UNUSED_6
Definition: Unit.h:506
@ UNIT_FLAG_CANNOT_SWIM
Definition: Unit.h:462
@ UNIT_FLAG_POSSESSED
Definition: Unit.h:472
@ UNIT_FLAG_SWIMMING
Definition: Unit.h:463
@ UNIT_FLAG_RENAME
Definition: Unit.h:452
@ UNIT_FLAG_PET_IN_COMBAT
Definition: Unit.h:459
bool HasUnitFlag2(UnitFlags2 flags) const
Definition: Unit.h:1486

References HasUnitFlag(), HasUnitFlag2(), UNIT_FLAG2_UNUSED_6, UNIT_FLAG_CANNOT_SWIM, UNIT_FLAG_PET_IN_COMBAT, UNIT_FLAG_POSSESSED, UNIT_FLAG_RENAME, and UNIT_FLAG_SWIMMING.

Referenced by Creature::CanSwim().

◆ CanUseAttackType()

◆ CastCustomSpell() [1/4]

SpellCastResult Unit::CastCustomSpell ( uint32  spellId,
CustomSpellValues const &  value,
Unit victim = nullptr,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1253{
1254 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1255 if (!spellInfo)
1256 {
1257 LOG_ERROR("entities.unit", "CastSpell: unknown spell {} by caster {}", spellId, GetGUID().ToString());
1259 }
1260
1261 SpellCastTargets targets;
1262 targets.SetUnitTarget(victim);
1263
1264 return CastSpell(targets, spellInfo, &value, triggerFlags, castItem, triggeredByAura, originalCaster);
1265}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:159
@ SPELL_FAILED_SPELL_UNAVAILABLE
Definition: SharedDefines.h:1028
Definition: Spell.h:109
void SetUnitTarget(Unit *target)
Definition: Spell.cpp:233

References CastSpell(), Object::GetGUID(), LOG_ERROR, SpellCastTargets::SetUnitTarget(), SPELL_FAILED_SPELL_UNAVAILABLE, sSpellMgr, and Position::ToString().

◆ CastCustomSpell() [2/4]

SpellCastResult Unit::CastCustomSpell ( uint32  spellId,
SpellValueMod  mod,
int32  value,
Unit victim,
bool  triggered,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1239{
1240 CustomSpellValues values;
1241 values.AddSpellMod(mod, value);
1242 return CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1243}
@ TRIGGERED_NONE
Definition: SpellDefines.h:131
SpellCastResult CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1226
Definition: SpellDefines.h:162
void AddSpellMod(SpellValueMod mod, int32 value)
Definition: SpellDefines.h:164

References CustomSpellValues::AddSpellMod(), CastCustomSpell(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastCustomSpell() [3/4]

SpellCastResult Unit::CastCustomSpell ( uint32  spellId,
SpellValueMod  mod,
int32  value,
Unit victim = nullptr,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1246{
1247 CustomSpellValues values;
1248 values.AddSpellMod(mod, value);
1249 return CastCustomSpell(spellId, values, target, triggerFlags, castItem, triggeredByAura, originalCaster);
1250}

References CustomSpellValues::AddSpellMod(), and CastCustomSpell().

◆ CastCustomSpell() [4/4]

SpellCastResult Unit::CastCustomSpell ( Unit victim,
uint32  spellId,
int32 const *  bp0,
int32 const *  bp1,
int32 const *  bp2,
bool  triggered,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1227{
1228 CustomSpellValues values;
1229 if (bp0)
1230 values.AddSpellMod(SPELLVALUE_BASE_POINT0, *bp0);
1231 if (bp1)
1232 values.AddSpellMod(SPELLVALUE_BASE_POINT1, *bp1);
1233 if (bp2)
1234 values.AddSpellMod(SPELLVALUE_BASE_POINT2, *bp2);
1235 return CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1236}
@ SPELLVALUE_BASE_POINT1
Definition: SpellDefines.h:115
@ SPELLVALUE_BASE_POINT2
Definition: SpellDefines.h:116
@ SPELLVALUE_BASE_POINT0
Definition: SpellDefines.h:114

References CustomSpellValues::AddSpellMod(), CastCustomSpell(), SPELLVALUE_BASE_POINT0, SPELLVALUE_BASE_POINT1, SPELLVALUE_BASE_POINT2, TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

Referenced by spell_pri_guardian_spirit::Absorb(), spell_mage_fire_frost_ward::Absorb(), spell_pal_ardent_defender::Absorb(), spell_dru_survival_instincts_aura::AfterApply(), spell_the_lich_king_necrotic_plague_jump::spell_the_lich_king_necrotic_plague_AuraScript::AfterDispel(), spell_dru_lifebloom::AfterRemove(), Player::ApplyEnchantment(), CastCustomSpell(), CastDelayedSpellWithPeriodicAmount(), npc_gas_cloud::npc_gas_cloudAI::CastMainSpell(), CastPetAura(), spell_ruby_sanctum_rallying_shout::spell_ruby_sanctum_rallying_shout_SpellScript::CountAllies(), spell_igb_rocket_artillery_explosion::spell_igb_rocket_artillery_explosion_SpellScript::DamageGunship(), boss_sister_svalna::boss_sister_svalnaAI::DoAction(), Spell::EffectDestroyAllTotems(), Spell::EffectDispel(), Spell::EffectFeedPet(), Spell::EffectForceCast(), Spell::EffectSchoolDMG(), Spell::EffectScriptEffect(), Spell::EffectSummonType(), EnterVehicle(), EnterVehicleUnattackable(), AuraMunchingQueue::Execute(), TriggerWickedSpirit::Execute(), spell_sha_totem_of_wrath::HandleAfterCast(), spell_dk_scourge_strike::HandleAfterHit(), spell_dru_enrage::HandleApply(), spell_pal_avenging_wrath::HandleApply(), AuraEffect::HandleAuraLinked(), AuraEffect::HandleAuraModShapeshift(), HandleAuraProc(), HandleAuraRaidProcFromChargeWithValue(), Aura::HandleAuraSpecificMods(), spell_pri_shadow_word_death::HandleDamage(), spell_dk_corpse_explosion::HandleDamage(), spell_dru_lifebloom::HandleDispel(), spell_igb_burning_pitch::spell_igb_burning_pitch_SpellScript::HandleDummy(), spell_ahn_kahet_swarmer_aura::HandleDummy(), spell_deathbringer_blood_link::spell_deathbringer_blood_link_SpellScript::HandleDummy(), spell_dk_death_coil::HandleDummy(), spell_dk_death_strike::HandleDummy(), spell_gen_dummy_trigger::HandleDummy(), spell_hun_last_stand_pet::HandleDummy(), spell_pal_divine_storm_dummy::HandleDummy(), spell_sha_ancestral_awakening_proc::HandleDummy(), spell_sha_cleansing_totem_pulse::HandleDummy(), spell_warl_life_tap::HandleDummy(), spell_warr_last_stand::HandleDummy(), spell_warr_charge::HandleDummy(), spell_warr_slam::HandleDummy(), spell_warr_bloodthirst::HandleDummy(), HandleDummyAuraProc(), spell_egg_explosion::HandleDummyHitTarget(), spell_warr_execute::HandleEffect(), spell_dk_improved_blood_presence::HandleEffectApply(), spell_dk_improved_frost_presence::HandleEffectApply(), spell_dk_improved_unholy_presence::HandleEffectApply(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), spell_dk_presence::HandleImprovedBloodPresence(), spell_dk_presence::HandleImprovedFrostPresence(), spell_dk_presence::HandleImprovedUnholyPresence(), spell_ragin_flames_inferno::spell_ragin_flames_inferno_AuraScript::HandlePeriodic(), spell_dk_death_and_decay_aura::HandlePeriodic(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_deathbringer_blood_link_aura::spell_deathbringer_blood_link_AuraScript::HandleProc(), spell_deathbringer_blood_link_blood_beast_aura::spell_deathbringer_blood_link_blood_beast_aura_AuraScript::HandleProc(), spell_reliquary_of_souls_aura_of_desire::spell_reliquary_of_souls_aura_of_desire_AuraScript::HandleProc(), spell_black_temple_consuming_strikes::spell_black_temple_consuming_strikes_AuraScript::HandleProc(), spell_item_blade_ward_enchant::HandleProc(), spell_item_blood_draining_enchant::HandleProc(), spell_dru_living_seed_proc::HandleProc(), spell_hun_ascpect_of_the_viper::HandleProc(), spell_sha_earth_shield::HandleProc(), spell_the_lich_king_dark_hunger::spell_the_lich_king_dark_hunger_AuraScript::HandleProc(), spell_yogg_saron_grim_reprisal::spell_yogg_saron_grim_reprisal_AuraScript::HandleProc(), spell_dk_wandering_plague_aura::HandleProc(), spell_dk_blood_gorged::HandleProc(), spell_dru_living_seed::HandleProc(), spell_gen_blade_warding::HandleProc(), spell_hun_glyph_of_arcane_shot::HandleProc(), spell_item_blessing_of_ancient_kings::HandleProc(), spell_item_necrotic_touch::HandleProc(), spell_mage_burnout::HandleProc(), spell_pal_seal_of_command_aura::HandleProc(), spell_pal_sacred_shield_base::HandleProc(), spell_pal_seal_of_righteousness::HandleProc(), spell_pri_divine_aegis::HandleProc(), spell_pri_glyph_of_prayer_of_healing::HandleProc(), spell_rog_blade_flurry::HandleProc(), spell_sha_item_mana_surge::HandleProc(), spell_warr_sweeping_strikes::HandleProc(), HandleProcTriggerSpell(), AuraEffect::HandleProcTriggerSpellWithValueAuraProc(), AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(), spell_igb_rocket_pack::spell_igb_rocket_pack_AuraScript::HandleRemove(), spell_warl_haunt_aura::HandleRemove(), spell_pal_lay_on_hands::HandleScript(), spell_kelthuzad_detonate_mana::spell_kelthuzad_detonate_mana_AuraScript::HandleScript(), spell_q12919_gymers_grab::HandleScript(), spell_gluth_decimate::spell_gluth_decimate_SpellScript::HandleScriptEffect(), spell_hun_chimera_shot::HandleScriptEffect(), AuraEffect::HandleShapeshiftBoosts(), HandleSpellClick(), boss_akilzon::boss_akilzonAI::HandleStormSequence(), spell_halion_damage_aoe_summon::spell_halion_damage_aoe_summon_SpellScript::HandleSummon(), spell_putricide_mutated_transformation::spell_putricide_mutated_transformation_SpellScript::HandleSummon(), spell_putricide_mutated_plague::spell_putricide_mutated_plague_AuraScript::HandleTriggerSpell(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_frost_tomb::npc_frost_tombAI::npc_frost_tombAI(), spell_dru_tiger_s_fury::OnHit(), spell_gen_flurry_of_claws::OnPeriodic(), spell_blood_queen_essence_of_the_blood_queen::spell_blood_queen_essence_of_the_blood_queen_AuraScript::OnProc(), spell_pal_eye_for_an_eye::OnProc(), spell_warl_siphon_life::OnProc(), spell_warl_fel_synergy::OnProc(), spell_warr_improved_spell_reflection::OnProc(), spell_warr_damage_shield::OnProc(), spell_kalecgos_curse_of_boundless_agony::spell_kalecgos_curse_of_boundless_agony_AuraScript::OnRemove(), spell_halion_marks::spell_halion_marks_AuraScript::OnRemove(), spell_putricide_mutated_plague::spell_putricide_mutated_plague_AuraScript::OnRemove(), spell_the_lich_king_necrotic_plague::spell_the_lich_king_necrotic_plague_AuraScript::OnRemove(), spell_yogg_saron_malady_of_the_mind::spell_yogg_saron_malady_of_the_mind_AuraScript::OnRemove(), spell_sindragosa_instability::spell_sindragosa_instability_AuraScript::OnRemove(), spell_the_lich_king_necrotic_plague_jump::spell_the_lich_king_necrotic_plague_AuraScript::OnRemove(), spell_karazhan_overload::spell_karazhan_overload_AuraScript::PeriodicTick(), spell_blood_queen_pact_of_the_darkfallen_dmg::spell_blood_queen_pact_of_the_darkfallen_dmg_AuraScript::PeriodicTick(), spell_broggok_poison_cloud::spell_broggok_poison_cloud_AuraScript::PeriodicTick(), spell_serpentshrine_cavern_infection::spell_serpentshrine_cavern_infection_AuraScript::PrepareAuraScript(), spell_item_oracle_ablutions::PrepareSpellScript(), spell_q11198_take_down_tethyr::PrepareSpellScript(), spell_illidari_council_reflective_shield::spell_illidari_council_reflective_shield_AuraScript::ReflectDamage(), spell_pri_power_word_shield_aura::ReflectDamage(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::Reset(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::SpellHitTarget(), npc_simon_bunny::npc_simon_bunnyAI::SpellHitTarget(), boss_viscidus::SummonedCreatureDies(), spell_dk_anti_magic_shell_self::Trigger(), spell_mage_incanters_absorbtion_base_AuraScript::Trigger(), spell_the_lich_king_life_siphon::spell_the_lich_king_life_siphon_SpellScript::TriggerHeal(), spell_pal_divine_storm::TriggerHeal(), spell_black_temple_shadow_inferno::spell_black_temple_shadow_inferno_AuraScript::Update(), spell_black_temple_spell_absorption::spell_black_temple_spell_absorption_AuraScript::Update(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::UpdateAI(), boss_alythess::boss_alythessAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), boss_sathrovarr::boss_sathrovarrAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), npc_coren_direbrew::UpdateAI(), alliance_rifleman::alliance_riflemanAI::UpdateAI(), boss_huhuran::UpdateAI(), boss_krik_thir::boss_krik_thirAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), boss_festergut::boss_festergutAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_faerlina::boss_faerlinaAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_noth::boss_nothAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), npc_living_constellation::npc_living_constellationAI::UpdateAI(), boss_freya::boss_freyaAI::UpdateAI(), boss_freya_elder_brightleaf::boss_freya_elder_brightleafAI::UpdateAI(), boss_freya_elder_ironbranch::boss_freya_elder_ironbranchAI::UpdateAI(), npc_ulduar_hodir_priest::npc_ulduar_hodir_priestAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), boss_thorim::boss_thorimAI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::UpdateAI(), boss_yoggsaron::boss_yoggsaronAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_emalon::boss_emalonAI::UpdateAI(), boss_toravon::boss_toravonAI::UpdateAI(), boss_gurtogg_bloodboil::boss_gurtogg_bloodboilAI::UpdateAI(), boss_mother_shahraz::boss_shahrazAI::UpdateAI(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::UpdateAI(), boss_essence_of_suffering::boss_essence_of_sufferingAI::UpdateAI(), boss_essence_of_anger::boss_essence_of_angerAI::UpdateAI(), boss_teron_gorefiend::boss_teron_gorefiendAI::UpdateAI(), boss_najentus::boss_najentusAI::UpdateAI(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::UpdateAI(), boss_morogrim_tidewalker::boss_morogrim_tidewalkerAI::UpdateAI(), boss_ahune::boss_ahuneAI::UpdateAI(), boss_magtheridon::boss_magtheridonAI::UpdateAI(), and boss_kaelthas::boss_kaelthasAI::UpdateAI().

◆ CastDelayedSpellWithPeriodicAmount()

void Unit::CastDelayedSpellWithPeriodicAmount ( Unit caster,
uint32  spellId,
AuraType  auraType,
int32  addAmount,
uint8  effectIndex = 0 
)
20419{
20420 for (AuraEffectList::iterator i = m_modAuras[auraType].begin(); i != m_modAuras[auraType].end(); ++i)
20421 {
20422 AuraEffect* aurEff = *i;
20423 if (aurEff->GetCasterGUID() != caster->GetGUID() || aurEff->GetId() != spellId || aurEff->GetEffIndex() != effectIndex || !aurEff->GetTotalTicks())
20424 continue;
20425
20426 addAmount += ((aurEff->GetOldAmount() * std::max<int32>(aurEff->GetTotalTicks() - int32(aurEff->GetTickNumber()), 0)) / aurEff->GetTotalTicks());
20427 break;
20428 }
20429
20430 // xinef: delay only for casting on different unit
20431 if (this == caster)
20432 caster->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, addAmount, this, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_NO_PERIODIC_RESET), nullptr, nullptr, caster->GetGUID());
20433 else
20434 caster->m_Events.AddEvent(new AuraMunchingQueue(*caster, GetGUID(), addAmount, spellId), caster->m_Events.CalculateQueueTime(400));
20435}
TriggerCastFlags
Definition: SpellDefines.h:130
@ TRIGGERED_NO_PERIODIC_RESET
Will ignore equipped item requirements.
Definition: SpellDefines.h:150
uint64 CalculateQueueTime(uint64 delay) const
Definition: EventProcessor.cpp:141
Definition: Unit.cpp:20398
uint32 GetTickNumber() const
Definition: SpellAuraEffects.h:86
int32 GetOldAmount() const
Definition: SpellAuraEffects.h:115
uint32 GetId() const
Definition: SpellAuraEffects.cpp:432
int32 GetTotalTicks() const
Definition: SpellAuraEffects.cpp:7013
ObjectGuid GetCasterGUID() const
Definition: SpellAuraEffects.h:48

References EventProcessor::AddEvent(), EventProcessor::CalculateQueueTime(), CastCustomSpell(), AuraEffect::GetCasterGUID(), AuraEffect::GetEffIndex(), Object::GetGUID(), AuraEffect::GetId(), AuraEffect::GetOldAmount(), AuraEffect::GetTickNumber(), AuraEffect::GetTotalTicks(), m_Events, m_modAuras, SPELLVALUE_BASE_POINT0, TRIGGERED_FULL_MASK, and TRIGGERED_NO_PERIODIC_RESET.

Referenced by HandleDummyAuraProc(), spell_mage_ignite::HandleProc(), spell_dru_t10_balance_4p_bonus::HandleProc(), spell_sha_t10_restoration_4p_bonus::HandleProc(), and HandleProcTriggerSpell().

◆ CastPetAura()

void Unit::CastPetAura ( PetAura const *  aura)
17456{
17457 uint32 auraId = aura->GetAura(GetEntry());
17458 if (!auraId)
17459 return;
17460
17461 if (auraId == 35696) // Demonic Knowledge
17462 {
17463 int32 basePoints = aura->GetDamage();
17464 CastCustomSpell(this, auraId, &basePoints, nullptr, nullptr, true);
17465 }
17466 else
17467 CastSpell(this, auraId, true);
17468}

References CastCustomSpell(), CastSpell(), PetAura::GetAura(), PetAura::GetDamage(), and Object::GetEntry().

Referenced by Pet::CastPetAuras().

◆ CastSpell() [1/7]

SpellCastResult Unit::CastSpell ( float  x,
float  y,
float  z,
uint32  spellId,
bool  triggered,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1268{
1269 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1270 if (!spellInfo)
1271 {
1272 LOG_ERROR("entities.unit", "CastSpell: unknown spell {} by caster {}", spellId, GetGUID().ToString());
1274 }
1275
1276 SpellCastTargets targets;
1277 targets.SetDst(x, y, z, GetOrientation());
1278
1279 return CastSpell(targets, spellInfo, nullptr, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1280}
void SetDst(float x, float y, float z, float orientation, uint32 mapId=MAPID_INVALID)
Definition: Spell.cpp:400

References CastSpell(), Object::GetGUID(), Position::GetOrientation(), LOG_ERROR, SpellCastTargets::SetDst(), SPELL_FAILED_SPELL_UNAVAILABLE, sSpellMgr, Position::ToString(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastSpell() [2/7]

SpellCastResult Unit::CastSpell ( GameObject go,
uint32  spellId,
bool  triggered,
Item castItem = nullptr,
AuraEffect triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1283{
1284 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1285 if (!spellInfo)
1286 {
1287 LOG_ERROR("entities.unit", "CastSpell: unknown spell {} by caster {}", spellId, GetGUID().ToString());
1289 }
1290
1291 SpellCastTargets targets;
1292 targets.SetGOTarget(go);
1293
1294 return CastSpell(targets, spellInfo, nullptr, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1295}
void SetGOTarget(GameObject *target)
Definition: Spell.cpp:265

References CastSpell(), Object::GetGUID(), LOG_ERROR, SpellCastTargets::SetGOTarget(), SPELL_FAILED_SPELL_UNAVAILABLE, sSpellMgr, Position::ToString(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastSpell() [3/7]

SpellCastResult Unit::CastSpell ( SpellCastTargets const &  targets,
SpellInfo const *  spellInfo,
CustomSpellValues const *  value,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1170{
1171 if (!spellInfo)
1172 {
1173 LOG_ERROR("entities.unit", "CastSpell: unknown spell by caster {}", GetGUID().ToString());
1175 }
1176
1177 // TODO: this is a workaround - not needed anymore, but required for some scripts :(
1178 if (!originalCaster && triggeredByAura)
1179 {
1180 originalCaster = triggeredByAura->GetCasterGUID();
1181 }
1182
1183 Spell* spell = new Spell(this, spellInfo, triggerFlags, originalCaster);
1184
1185 if (value)
1186 {
1187 for (CustomSpellValues::const_iterator itr = value->begin(); itr != value->end(); ++itr)
1188 {
1189 spell->SetSpellValue(itr->first, itr->second);
1190 }
1191 }
1192
1193 spell->m_CastItem = castItem;
1194 return spell->prepare(&targets, triggeredByAura);
1195}
void SetSpellValue(SpellValueMod mod, int32 value)
Definition: Spell.cpp:8392
Item * m_CastItem
Definition: Spell.h:521

References AuraEffect::GetCasterGUID(), Object::GetGUID(), LOG_ERROR, Spell::m_CastItem, Spell::prepare(), Spell::SetSpellValue(), SPELL_FAILED_SPELL_UNAVAILABLE, and Position::ToString().

Referenced by Player::_addSpell(), Player::_addTalentAurasAndSpells(), Spell::_cast(), _ExitVehicle(), Player::_LoadGlyphAuras(), Battleground::_ProcessResurrect(), spell_yogg_saron_protective_gaze::spell_yogg_saron_protective_gaze_AuraScript::Absorb(), spell_rog_cheat_death::Absorb(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::Activate(), Player::ActivateSpec(), spell_halion_combustion_consumption::spell_halion_combustion_consumption_AuraScript::AddMarkStack(), Battleground::AddPlayer(), Arena::AddPlayer(), BattlegroundIC::AddPlayer(), BattlegroundMap::AddPlayerToMap(), Battleground::AddPlayerToResurrectQueue(), Pet::addSpell(), spell_dru_barkskin::AfterApply(), spell_dru_savage_roar_aura::AfterApply(), spell_astromancer_wrath_of_the_astromancer::spell_astromancer_wrath_of_the_astromancer_AuraScript::AfterRemove(), spell_gen_lifebloom::AfterRemove(), spell_oculus_stop_time::spell_oculus_stop_time_AuraScript::Apply(), spell_sha_earthbind_totem::Apply(), spell_warl_health_funnel::ApplyEffect(), Player::ApplyEnchantment(), Player::ApplyEquipSpell(), spell_hun_lock_and_load::ApplyMarker(), npc_mograine::npc_mograineAI::AshbringerEvent(), npc_ritual_channeler::npc_ritual_channelerAI::AttackStart(), npc_dark_nucleus::npc_dark_nucleusAI::AttackStart(), boss_grand_champion::boss_grand_championAI::boss_grand_championAI(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::boss_yoggsaron_crusher_tentacleAI(), boss_yoggsaron_death_orb::boss_yoggsaron_death_orbAI::boss_yoggsaron_death_orbAI(), boss_yoggsaron_influence_tentacle::boss_yoggsaron_influence_tentacleAI::boss_yoggsaron_influence_tentacleAI(), Player::BuildPlayerRepop(), spell_igb_incinerating_blast::spell_igb_incinerating_blast_SpellScript::CalculateDamage(), CastCustomSpell(), npc_hallows_end_soh::CastFires(), Player::CastItemCombatSpell(), npc_volatile_ooze::npc_volatile_oozeAI::CastMainSpell(), CastPetAura(), boss_mor_grayhoof::CastRandomSpell(), GameObject::CastSpell(), CastSpell(), spell_the_lich_king_defile::spell_the_lich_king_defile_SpellScript::ChangeDamageAndGrow(), boss_professor_putricide::boss_professor_putricideAI::ChangePhase(), spell_eredar_twins_handle_touch::spell_eredar_twins_handle_touch_SpellScript::CheckCast(), boss_kelidan_the_breaker::boss_kelidan_the_breakerAI::CheckChannelers(), spell_igb_cannon_blast::spell_igb_cannon_blast_SpellScript::CheckEnergy(), Spell::CheckItems(), spell_botanica_shift_form::spell_botanica_shift_form_AuraScript::CheckProc(), boss_isle_of_conquest::boss_isle_of_conquestAI::CheckRageBuff(), spell_the_lich_king_shadow_trap_periodic::spell_the_lich_king_shadow_trap_periodic_SpellScript::CheckTargetCount(), spell_dk_raise_dead::ConsumeReagents(), spell_frost_giant_death_plague::spell_frost_giant_death_plague_SpellScript::CountTargets(), instance_blackrock_spire::instance_blackrock_spireMapScript::CreatureLooted(), violet_hold_trashAI::CreatureStartAttackDoor(), boss_garfrost::boss_garfrostAI::DamageTaken(), boss_baron_geddon::boss_baron_geddonAI::DamageTaken(), npc_mograine::npc_mograineAI::DamageTaken(), boss_muru::boss_muruAI::DamageTaken(), boss_headless_horseman::DamageTaken(), boss_headless_horseman_head::DamageTaken(), boss_sartharion::boss_sartharionAI::DamageTaken(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), npc_argent_soldier::npc_argent_soldierAI::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DamageTaken(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DamageTaken(), npc_gunship_boarding_addAI::DamageTaken(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DamageTaken(), npc_power_spark::npc_power_sparkAI::DamageTaken(), npc_crystalline_frayer::npc_crystalline_frayerAI::DamageTaken(), npc_collapsing_star::npc_collapsing_starAI::DamageTaken(), boss_freya::boss_freyaAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), boss_illidan_stormrage::boss_illidan_stormrageAI::DamageTaken(), boss_vazruden::boss_vazrudenAI::DamageTaken(), boss_alar::boss_alarAI::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::DamageTaken(), DealDamage(), DealMeleeDamage(), boss_twin_valkyrAI::DoAction(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), npc_icc_severed_essence::npc_icc_severed_essenceAI::DoAction(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::DoAction(), npc_eris_hevenfire::npc_eris_hevenfireAI::DoAction(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), boss_the_lich_king::boss_the_lich_kingAI::DoAction(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), boss_flame_leviathan::boss_flame_leviathanAI::DoAction(), boss_sacrolash::boss_sacrolashAI::DoAction(), boss_alythess::boss_alythessAI::DoAction(), boss_kalecgos::boss_kalecgosAI::DoAction(), boss_sathrovarr::boss_sathrovarrAI::DoAction(), npc_kalecgos_kj::npc_kalecgos_kjAI::DoAction(), npc_pilgrims_bounty_chair::DoAction(), boss_black_knight::boss_black_knightAI::DoAction(), boss_jormungarAI::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), npc_icc_blood_beast::npc_icc_blood_beastAI::DoAction(), npc_icc_putricades_trap::npc_icc_putricades_trapAI::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), npc_molten_golem::npc_molten_golemAI::DoAction(), boss_steelbreaker::boss_steelbreakerAI::DoAction(), npc_ulduar_bot_summon_trigger::npc_ulduar_bot_summon_triggerAI::DoAction(), boss_thorim_sif::boss_thorim_sifAI::DoAction(), boss_xt002::boss_xt002AI::DoAction(), npc_xt002_heart::npc_xt002_heartAI::DoAction(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DoAction(), boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::DoAction(), boss_yoggsaron_keeper::boss_yoggsaron_keeperAI::DoAction(), boss_illidari_council_memberAI::DoAction(), npc_naga_distiller::npc_naga_distillerAI::DoAction(), boss_pathaleon_the_calculator::boss_pathaleon_the_calculatorAI::DoAction(), Spell::DoAllEffectOnTarget(), UnitAI::DoCast(), UnitAI::DoCastAOE(), ScriptedAI::DoCastSpell(), UnitAI::DoCastToAllHostilePlayers(), boss_ichoron::boss_ichoronAI::DoExplodeCompleted(), UnitAI::DoSpellAttackIfReady(), UnitAI::DoSpellAttackToRandomTargetIfReady(), instance_mechanar::instance_mechanar_InstanceMapScript::DoSummonAction(), boss_skeram::DoTeleport(), boss_laj::boss_lajAI::DoTransform(), Spell::DoTriggersOnSpellHit(), Player::DuelComplete(), Spell::EffectActivateRune(), Spell::EffectApplyGlyph(), Spell::EffectCastButtons(), Spell::EffectDummy(), Spell::EffectEnergize(), Spell::EffectForceCast(), Spell::EffectHeal(), Spell::EffectInebriate(), Spell::EffectSanctuary(), Spell::EffectSchoolDMG(), Spell::EffectScriptEffect(), Spell::EffectStuck(), Spell::EffectSummonType(), Spell::EffectTaunt(), Spell::EffectTeleportUnits(), Spell::EffectTitanGrip(), Spell::EffectTriggerMissileSpell(), Spell::EffectTriggerRitualOfSummoning(), Spell::EffectTriggerSpell(), Spell::EffectWeaponDmg(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::EmpowerCultist(), boss_malchezaar::boss_malchezaarAI::EnfeebleHealthEffect(), CasterAI::EnterCombat(), npc_mograine::npc_mograineAI::EnterCombat(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::EnterCombat(), npc_hallows_end_soh::EnterCombat(), boss_captain_skarloc::boss_captain_skarlocAI::EnterCombat(), boss_eadric::boss_eadricAI::EnterCombat(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::EnterCombat(), boss_twin_valkyrAI::EnterCombat(), boss_garfrost::boss_garfrostAI::EnterCombat(), npc_stinky_icc::npc_stinky_iccAI::EnterCombat(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterCombat(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterCombat(), npc_rimefang::npc_rimefangAI::EnterCombat(), boss_urom::boss_uromAI::EnterCombat(), boss_freya::boss_freyaAI::EnterCombat(), boss_freya_summons::boss_freya_summonsAI::EnterCombat(), boss_vezax::boss_vezaxAI::EnterCombat(), boss_hodir::boss_hodirAI::EnterCombat(), boss_thorim::boss_thorimAI::EnterCombat(), boss_thorim_ancient_rune_giant::boss_thorim_ancient_rune_giantAI::EnterCombat(), npc_ulduar_storm_tempered_keeper::npc_ulduar_storm_tempered_keeperAI::EnterCombat(), boss_koralon::boss_koralonAI::EnterCombat(), boss_toravon::boss_toravonAI::EnterCombat(), boss_ichoron::boss_ichoronAI::EnterCombat(), boss_moragg::boss_moraggAI::EnterCombat(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::EnterCombat(), boss_essence_of_suffering::boss_essence_of_sufferingAI::EnterCombat(), boss_essence_of_desire::boss_essence_of_desireAI::EnterCombat(), boss_essence_of_anger::boss_essence_of_angerAI::EnterCombat(), boss_nethermancer_sepethrea::boss_nethermancer_sepethreaAI::EnterCombat(), npc_pet_shaman_fire_elemental::EnterCombat(), boss_sartharion::boss_sartharionAI::EnterCombat(), boss_sindragosa::boss_sindragosaAI::EnterCombat(), npc_artorius::npc_artoriusAI::EnterCombat(), npc_simone::npc_simoneAI::EnterCombat(), npc_nelson::npc_nelsonAI::EnterCombat(), npc_franklin::npc_franklinAI::EnterCombat(), CombatAI::EnterCombat(), boss_ellris_duskhallow::boss_ellris_duskhallowAI::EnterCombat(), boss_warlord_salaris::boss_warlord_salarisAI::EnterCombat(), boss_garaxxas::boss_garaxxasAI::EnterCombat(), boss_muru::boss_muruAI::EnterCombat(), boss_yauj::EnterCombat(), boss_novos::boss_novosAI::EnterCombat(), boss_moorabi::boss_moorabiAI::EnterCombat(), boss_prince_valanar_icc::boss_prince_valanarAI::EnterCombat(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::EnterCombat(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::EnterCombat(), boss_professor_putricide::boss_professor_putricideAI::EnterCombat(), boss_kelthuzad::boss_kelthuzadAI::EnterCombat(), boss_sapphiron::boss_sapphironAI::EnterCombat(), boss_keristrasza::boss_keristraszaAI::EnterCombat(), boss_steelbreaker::boss_steelbreakerAI::EnterCombat(), boss_gurtogg_bloodboil::boss_gurtogg_bloodboilAI::EnterCombat(), boss_mother_shahraz::boss_shahrazAI::EnterCombat(), boss_lady_vashj::boss_lady_vashjAI::EnterCombat(), boss_the_lich_king::boss_the_lich_kingAI::EnterEvadeMode(), boss_zuljin::boss_zuljinAI::EnterPhase(), BattlegroundEY::EventPlayerClickedOnFlag(), BattlegroundWS::EventPlayerClickedOnFlag(), BattlegroundEY::EventPlayerDroppedFlag(), BattlegroundWS::EventPlayerDroppedFlag(), BattlegroundEY::EventTeamCapturedPoint(), BattleExperienceEvent::Execute(), OrcDeathEvent::Execute(), CastArmageddon::Execute(), UtherBatteredHiltEvent::Execute(), ShockVortexExplodeEvent::Execute(), ResetEncounterEvent::Execute(), FrostBombExplosion::Execute(), IceTombSummonEvent::Execute(), VileSpiritActivateEvent::Execute(), LichKingMovieEvent::Execute(), DelayedCastEvent::Execute(), DelayedCastMincharEvent::Execute(), ChargeRifts::Execute(), CosmicSmashDamageEvent::Execute(), CastRunesEvent::Execute(), BoomEvent::Execute(), SACActivateEvent::Execute(), VerasEnvenom::Execute(), CastQuill::Execute(), lapseTeleport::Execute(), boss_salramm::boss_salrammAI::ExplodeGhoul(), spell_festergut_blighted_spores::spell_festergut_blighted_spores_AuraScript::ExtraEffect(), spell_rotface_mutated_infection::spell_rotface_mutated_infection_AuraScript::ExtraRemoveEffect(), npc_dark_iron_attack_generator::FinishAttackDueToWin(), npc_azure_saboteur::npc_azure_saboteurAI::FinishPointReached(), boss_janalai::boss_janalaiAI::FireWall(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::FlyAway(), boss_archimonde::boss_archimondeAI::GainSoulCharge(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::GoSiphon(), go_soulwell::go_soulwellAI::GossipHello(), spell_cataclysm_breath::spell_cataclysm_breath_SpellScript::HandleAfterCast(), spell_dk_chains_of_ice::HandleAfterCast(), spell_mage_arcane_blast::HandleAfterCast(), spell_q13086_last_line_of_defence::HandleAfterCast(), spell_infected_worgen_bite::spell_infected_worgen_bite_AuraScript::HandleAfterEffectApply(), spell_dk_blood_boil::HandleAfterHit(), spell_dk_scourge_strike::HandleAfterHit(), spell_rog_deadly_poison::HandleAfterHit(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), spell_felmyst_fog_of_corruption_charm::spell_felmyst_fog_of_corruption_charm_AuraScript::HandleApply(), spell_kiljaeden_vengeance_of_the_blue_flight::spell_kiljaeden_vengeance_of_the_blue_flight_AuraScript::HandleApply(), spell_boss_magus_telestra_summon_telestra_clones::spell_boss_magus_telestra_summon_telestra_clones_AuraScript::HandleApply(), spell_dru_enrage::HandleApply(), spell_rog_killing_spree::spell_rog_killing_spree_AuraScript::HandleApply(), spell_warr_vigilance::HandleApply(), spell_azjol_nerub_pound::HandleApplyAura(), BattlegroundIC::HandleAreaTrigger(), OutdoorPvPSI::HandleAreaTrigger(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraLinked(), AuraEffect::HandleAuraModShapeshift(), HandleAuraProc(), HandleAuraRaidProcFromCharge(), HandleAuraRaidProcFromChargeWithValue(), Aura::HandleAuraSpecificMods(), spell_dk_death_grip::HandleBaseDummy(), misc_commandscript::HandleBindSightCommand(), spell_rotface_unstable_ooze_explosion_init::spell_rotface_unstable_ooze_explosion_init_SpellScript::HandleCast(), cast_commandscript::HandleCastBackCommand(), cast_commandscript::HandleCastCommand(), cast_commandscript::HandleCastDestCommand(), cast_commandscript::HandleCastDistCommand(), cast_commandscript::HandleCastSelfCommand(), cast_commandscript::HandleCastTargetCommad(), spell_gen_mounted_charge::HandleChargeEffect(), spell_dk_corpse_explosion::HandleCorpseExplosion(), OutdoorPvPSI::HandleCustomSpell(), WorldSession::HandleDuelCancelledOpcode(), spell_icc_shattered_bones::spell_icc_shattered_bones_SpellScript::HandleDummy(), spell_corrupted_totems::HandleDummy(), spell_moroes_vanish::spell_moroes_vanish_SpellScript::HandleDummy(), spell_karazhan_blink::spell_karazhan_blink_SpellScript::HandleDummy(), spell_midsummer_juggling_torch::HandleDummy(), spell_ooze_zap::spell_ooze_zap_SpellScript::HandleDummy(), spell_saviana_conflagration_init::spell_saviana_conflagration_init_SpellScript::HandleDummy(), spell_igb_burning_pitch_selector::spell_igb_burning_pitch_selector_SpellScript::HandleDummy(), spell_igb_burning_pitch::spell_igb_burning_pitch_SpellScript::HandleDummy(), spell_q13007_iron_colossus::spell_q13007_iron_colossus_SpellScript::HandleDummy(), spell_illidan_found_target::spell_illidan_found_target_SpellScript::HandleDummy(), spell_leotheras_chaos_blast::spell_leotheras_chaos_blast_SpellScript::HandleDummy(), spell_morogrim_tidewalker_watery_grave::spell_morogrim_tidewalker_watery_grave_SpellScript::HandleDummy(), spell_q10935_the_exorcism_of_colonel_jules::spell_q10935_the_exorcism_of_colonel_jules_SpellScript::HandleDummy(), spell_gen_focused_bursts::HandleDummy(), spell_shadowblink::HandleDummy(), spell_spawn_drakonid::HandleDummy(), spell_send_mug_target_picker::HandleDummy(), spell_hallows_end_candy::HandleDummy(), spell_hallows_end_bucket_lands::HandleDummy(), spell_midsummer_torch_catch::HandleDummy(), spell_pilgrims_bounty_pass_generic::HandleDummy(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), spell_mana_burn_area::HandleDummy(), spell_voljin_war_drums::spell_voljin_war_drums_SpellScript::HandleDummy(), spell_voodoo::spell_voodoo_SpellScript::HandleDummy(), spell_sartharion_lava_strike::spell_sartharion_lava_strike_SpellScript::HandleDummy(), spell_halion_meteor_strike_targeting::spell_halion_meteor_strike_targeting_SpellScript::HandleDummy(), spell_halion_twilight_division::spell_halion_twilight_division_SpellScript::HandleDummy(), spell_drakkari_colossus_emerge::spell_drakkari_colossus_emerge_SpellScript::HandleDummy(), spell_drakkari_colossus_surge::spell_drakkari_colossus_surge_SpellScript::HandleDummy(), spell_putricide_ooze_eruption_searcher::spell_putricide_ooze_eruption_searcher_SpellScript::HandleDummy(), spell_voa_flaming_cinder::spell_voa_flaming_cinder_SpellScript::HandleDummy(), spell_q12096_q12092_dummy::spell_q12096_q12092_dummy_SpellScript::HandleDummy(), spell_vehicle_warhead_fuse::spell_vehicle_warhead_fuse_SpellScript::HandleDummy(), spell_q12589_shoot_rjr::spell_q12589_shoot_rjr_SpellScript::HandleDummy(), spell_najentus_needle_spine::spell_najentus_needle_spine_SpellScript::HandleDummy(), spell_dru_starfall_dummy::HandleDummy(), spell_gen_cannibalize::HandleDummy(), spell_gen_gadgetzan_transporter_backfire::HandleDummy(), spell_gen_gnomish_transporter::HandleDummy(), spell_hun_masters_call::HandleDummy(), spell_hun_pet_carrion_feeder::HandleDummy(), spell_item_gnomish_universal_remote::HandleDummy(), spell_item_gnomish_shrink_ray::HandleDummy(), spell_item_trigger_spell::HandleDummy(), spell_item_deviate_fish::HandleDummy(), spell_item_flask_of_the_north::HandleDummy(), spell_item_make_a_wish::HandleDummy(), spell_item_mingos_fortune_generator::HandleDummy(), spell_item_net_o_matic::HandleDummy(), spell_item_noggenfogger_elixir::HandleDummy(), spell_item_savory_deviate_delight::HandleDummy(), spell_item_six_demon_bag::HandleDummy(), spell_item_underbelly_elixir::HandleDummy(), spell_item_vanquished_clutches::HandleDummy(), spell_item_purify_helboar_meat::HandleDummy(), spell_item_reindeer_transformation::HandleDummy(), spell_item_nigh_invulnerability::HandleDummy(), spell_item_poultryizer::HandleDummy(), spell_item_socrethars_stone::HandleDummy(), spell_item_demon_broiled_surprise::HandleDummy(), spell_item_complete_raptor_capture::HandleDummy(), spell_item_brewfest_mount_transformation::HandleDummy(), spell_item_nitro_boots::HandleDummy(), spell_item_teach_language::HandleDummy(), spell_item_rocket_boots::HandleDummy(), spell_item_pygmy_oil::HandleDummy(), spell_item_chicken_cover::HandleDummy(), spell_item_greatmothers_soulcatcher::HandleDummy(), spell_mage_summon_water_elemental::HandleDummy(), spell_pal_blessing_of_faith::HandleDummy(), spell_pal_holy_shock::HandleDummy(), spell_pal_judgement_of_command::HandleDummy(), spell_pri_penance::HandleDummy(), spell_q11520_discovering_your_roots::HandleDummy(), spell_q5206_test_fetid_skull::HandleDummy(), spell_q11396_11399_scourging_crystal_controller::HandleDummy(), spell_q11587_arcane_prisoner_rescue::HandleDummy(), spell_q11730_ultrasonic_screwdriver::HandleDummy(), spell_q12634_despawn_fruit_tosser::HandleDummy(), spell_q12683_take_sputum_sample::HandleDummy(), spell_q12937_relief_for_the_fallen::HandleDummy(), spell_q9452_cast_net::HandleDummy(), spell_q13291_q13292_q13239_q13261_frostbrood_skytalon_grab_decoy::HandleDummy(), spell_q12308_escape_from_silverbrook::HandleDummy(), spell_q12641_death_comes_from_on_high::HandleDummy(), spell_rog_shiv::HandleDummy(), spell_sha_fire_nova::HandleDummy(), spell_warl_ritual_of_doom_effect::HandleDummy(), spell_warl_soulshatter::HandleDummy(), spell_warr_charge::HandleDummy(), HandleDummyAuraProc(), spell_yogg_saron_destabilization_matrix::spell_yogg_saron_destabilization_matrix_SpellScript::HandleDummyEffect(), spell_yogg_saron_insane_periodic_trigger::spell_yogg_saron_insane_periodic_trigger_SpellScript::HandleDummyEffect(), spell_image_of_drakuru_reagent_check::HandleDummyEffect(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_shadowfang_keep_forsaken_skills::spell_shadowfang_keep_forsaken_skills_AuraScript::HandleDummyTick(), spell_item_rocket_chicken::HandleDummyTick(), spell_warl_demonic_circle_summon::HandleDummyTick(), spell_shadowfang_keep_haunting_spirits::spell_shadowfang_keep_haunting_spirits_AuraScript::HandleDummyTick(), spell_blood_council_shadow_prison::spell_blood_council_shadow_prison_AuraScript::HandleDummyTick(), spell_mark_of_nature::spell_mark_of_nature_SpellScript::HandleEffect(), spell_mc_play_dead::spell_mc_play_dead_AuraScript::HandleEffectApply(), spell_midsummer_ribbon_pole::HandleEffectApply(), spell_teron_gorefiend_shadowy_construct::spell_teron_gorefiend_shadowy_construct_AuraScript::HandleEffectApply(), spell_q12851_going_bearback::HandleEffectApply(), spell_oculus_soar::spell_oculus_soarAuraScript::HandleEffectPeriodic(), spell_gen_whisper_gulch_yogg_saron_whisper::HandleEffectPeriodic(), spell_rog_killing_spree::spell_rog_killing_spree_AuraScript::HandleEffectPeriodic(), spell_sha_earthbind_totem::HandleEffectPeriodic(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), spell_warr_retaliation::HandleEffectProc(), spell_q11919_q11940_drake_hunt::spell_q11919_q11940_drake_hunt_AuraScript::HandleEffectRemove(), spell_teron_gorefiend_shadow_of_death::spell_teron_gorefiend_shadow_of_death_AuraScript::HandleEffectRemove(), spell_q10930_big_bone_worm::spell_q10930_big_bone_worm_AuraScript::HandleEffectRemove(), spell_q10929_fumping::spell_q10929_fumping_AuraScript::HandleEffectRemove(), spell_midsummer_fling_torch::HandleFinish(), spell_midsummer_juggling_torch::HandleFinish(), spell_wintergrasp_rp_gg::spell_wintergrasp_rp_gg_SpellScript::HandleFinish(), spell_dreamwalker_summoner::spell_dreamwalker_summoner_SpellScript::HandleForceCast(), spell_dreamwalker_summon_suppresser_effect::spell_dreamwalker_summon_suppresser_effect_SpellScript::HandleForceCast(), spell_ioc_bomb_blast_criteria::spell_ioc_bomb_blast_criteria_SpellScript::HandleGameObjectDamage(), OPvPCapturePointZM_GraveYard::HandleGossipOption(), spell_item_crazy_alchemists_potion::HandleHeal(), spell_dk_presence::HandleImprovedBloodPresence(), spell_dk_presence::HandleImprovedFrostPresence(), spell_dk_presence::HandleImprovedUnholyPresence(), spell_sindragosa_frost_breath::spell_sindragosa_frost_breath_SpellScript::HandleInfusion(), OutdoorPvPHP::HandleKillImpl(), OutdoorPvPNA::HandleKillImpl(), OutdoorPvPZM::HandleKillImpl(), BattlegroundIC::HandleKillUnit(), WorldSession::HandleMoveSplineDoneOpcode(), WorldSession::HandleMoveTeleportAck(), WorldSession::HandleMoveWorldportAck(), spell_oculus_soar::spell_oculus_soarAuraScript::HandleOnEffectApply(), spell_oculus_rider_aura::spell_oculus_rider_auraAuraScript::HandleOnEffectApply(), spell_ticking_time_bomb::spell_ticking_time_bomb_AuraScript::HandleOnEffectRemove(), spell_delusions_of_jindo::HandleOnHit(), spell_arcane_vacuum::HandleOnHit(), spell_mark_of_frost_freeze::HandleOnHit(), spell_mutate_explode_bug::HandleOnHit(), spell_explode_trigger::HandleOnHit(), HandleOverrideClassScriptAuraProc(), aura_class_call_wild_magic::HandlePeriodic(), spell_shadow_sickle_periodic_damage::HandlePeriodic(), spell_hadronox_summon_periodic::spell_hadronox_summon_periodic_AuraScript::HandlePeriodic(), spell_halion_meteor_strike_spread::spell_halion_meteor_strike_spread_AuraScript::HandlePeriodic(), spell_sladran_grip_of_sladran::spell_sladran_grip_of_sladran_AuraScript::HandlePeriodic(), spell_algalon_phase_punch::spell_algalon_phase_punch_AuraScript::HandlePeriodic(), spell_close_rift::spell_close_rift_AuraScript::HandlePeriodic(), spell_serpentshrine_cavern_coilfang_water::spell_serpentshrine_cavern_coilfang_water_AuraScript::HandlePeriodic(), spell_kaelthas_remote_toy::spell_kaelthas_remote_toy_AuraScript::HandlePeriodic(), spell_q10923_evil_draws_near_periodic::spell_q10923_evil_draws_near_periodic_AuraScript::HandlePeriodic(), spell_sha_totemic_mastery::HandlePeriodic(), spell_garr_separation_nexiety::spell_garr_separation_nexiety_AuraScript::HandlePeriodic(), spell_majordomo_separation_nexiety::spell_majordomo_separation_nexiety_AuraScript::HandlePeriodic(), spell_kiljaeden_shadow_spike::spell_kiljaeden_shadow_spike_AuraScript::HandlePeriodic(), spell_kiljaeden_armageddon_periodic::spell_kiljaeden_armageddon_periodic_AuraScript::HandlePeriodic(), spell_halion_twilight_cutter_periodic::spell_halion_twilight_cutter_periodic_AuraScript::HandlePeriodic(), spell_oculus_ride_ruby_emerald_amber_drake_que::spell_oculus_ride_ruby_emerald_amber_drake_que_AuraScript::HandlePeriodic(), spell_hun_sniper_training::HandlePeriodic(), spell_shadow_bolt_whirl::HandlePeriodic(), spell_voa_overcharge::spell_voa_overcharge_AuraScript::HandlePeriodicDummy(), AuraEffect::HandlePeriodicDummyAuraTick(), spell_magtheridon_shadow_grasp::spell_magtheridon_shadow_grasp_AuraScript::HandlePeriodicRemove(), spell_igb_periodic_trigger_with_power_cost::spell_igb_periodic_trigger_with_power_cost_AuraScript::HandlePeriodicTick(), spell_item_enchanted_broom_periodic::HandlePeriodicTick(), spell_bronjahm_soulstorm_channel_ooc::spell_bronjahm_soulstorm_channel_ooc_AuraScript::HandlePeriodicTick(), spell_bronjahm_soulstorm_visual::spell_bronjahm_soulstorm_visual_AuraScript::HandlePeriodicTick(), spell_item_direbrew_remote_aura::HandlePeriodicTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), OutdoorPvPEP::HandlePlayerEnterZone(), OutdoorPvPHP::HandlePlayerEnterZone(), OutdoorPvPNA::HandlePlayerEnterZone(), OutdoorPvPSI::HandlePlayerEnterZone(), OutdoorPvPTF::HandlePlayerEnterZone(), OutdoorPvPZM::HandlePlayerEnterZone(), WorldSession::HandlePlayerLoginFromDB(), BattlegroundIC::HandlePlayerResurrect(), misc_commandscript::HandlePossessCommand(), spell_blood_queen_vampiric_bite::spell_blood_queen_vampiric_bite_SpellScript::HandlePresence(), spell_item_lil_phylactery::HandleProc(), spell_item_fate_rune_of_unsurpassed_vigor::HandleProc(), spell_mage_burning_determination::HandleProc(), spell_rog_tricks_of_the_trade::HandleProc(), spell_gyth_chromatic_protection::HandleProc(), spell_item_trauma::HandleProc(), spell_item_shadows_fate::HandleProc(), spell_utgarde_pinnacle_beast_mark::HandleProc(), spell_dk_scent_of_blood::HandleProc(), spell_hun_improved_mend_pet::HandleProc(), spell_hun_misdirection::HandleProc(), spell_item_aegis_of_preservation::HandleProc(), spell_item_desperate_defense::HandleProc(), spell_mage_focus_magic::HandleProc(), spell_pal_blessing_of_sanctuary::HandleProc(), spell_pri_item_greater_heal_refund::HandleProc(), spell_pri_mana_leech::HandleProc(), spell_sha_item_lightning_shield_trigger::HandleProc(), spell_warr_vigilance::HandleProc(), spell_dk_blood_caked_blade::HandleProc(), spell_dk_dancing_rune_weapon::HandleProc(), spell_gen_adaptive_warding::HandleProc(), spell_gen_moss_covered_feet::HandleProc(), spell_item_unsated_craving::HandleProc(), spell_item_shadowmourne::HandleProc(), spell_sha_item_lightning_shield::HandleProc(), spell_warl_glyph_of_shadowflame::HandleProc(), spell_warr_sweeping_strikes::HandleProc(), spell_hun_lock_and_load::HandleProcs(), HandleProcTriggerSpell(), AuraEffect::HandleProcTriggerSpellAuraProc(), WorldSession::HandleQuestgiverAcceptQuestOpcode(), AuraEffect::HandleRaidProcFromChargeAuraProc(), spell_dk_raise_dead::HandleRaiseDead(), spell_vael_burning_adrenaline::HandleRemove(), spell_kiljaeden_darkness::spell_kiljaeden_darkness_AuraScript::HandleRemove(), spell_entropius_void_zone_visual::spell_entropius_void_zone_visual_AuraScript::HandleRemove(), spell_igb_rocket_pack::spell_igb_rocket_pack_AuraScript::HandleRemove(), spell_najentus_hurl_spine::spell_najentus_hurl_spine_SpellScript::HandleSchoolDamage(), spell_gen_mine_sweeper::HandleSchoolDMG(), spell_warl_shadowflame::HandleSchoolDMG(), spell_gen_bandage::HandleScript(), spell_pal_lay_on_hands::HandleScript(), spell_kormok_summon_bone_mages::HandleScript(), spell_kormok_summon_bone_minions::HandleScript(), spell_energize_aoe::spell_energize_aoe_SpellScript::HandleScript(), spell_saviana_conflagration_throwback::spell_saviana_conflagration_throwback_SpellScript::HandleScript(), spell_taldaram_glittering_sparks::spell_taldaram_glittering_sparks_SpellScript::HandleScript(), spell_blood_queen_bloodbolt::spell_blood_queen_bloodbolt_SpellScript::HandleScript(), spell_blood_queen_presence_of_the_darkfallen::spell_blood_queen_presence_of_the_darkfallen_SpellScript::HandleScript(), spell_igb_rocket_artillery::spell_igb_rocket_artillery_SpellScript::HandleScript(), spell_putricide_unstable_experiment::spell_putricide_unstable_experiment_SpellScript::HandleScript(), spell_sindragosa_icy_grip::spell_sindragosa_icy_grip_SpellScript::HandleScript(), spell_the_lich_king_jump::spell_the_lich_king_jump_SpellScript::HandleScript(), spell_the_lich_king_summon_spirit_bomb::spell_the_lich_king_summon_spirit_bomb_SpellScript::HandleScript(), spell_dreamwalker_summon_portal::spell_dreamwalker_summon_portal_SpellScript::HandleScript(), spell_dreamwalker_twisted_nightmares::spell_dreamwalker_twisted_nightmares_SpellScript::HandleScript(), spell_archavon_rock_shards::spell_archavon_rock_shards_SpellScript::HandleScript(), spell_wintergrasp_portal::spell_wintergrasp_portal_SpellScript::HandleScript(), spell_gen_create_lance::HandleScript(), spell_item_defibrillate::HandleScript(), spell_item_scroll_of_recall::HandleScript(), spell_shazzrah_gate_dummy::spell_shazzrah_gate_dummy_SpellScript::HandleScript(), spell_apothecary_lingering_fumes::HandleScript(), spell_apothecary_validate_area::HandleScript(), spell_apothecary_throw_cologne::HandleScript(), spell_apothecary_throw_perfume::HandleScript(), spell_hallows_end_trick::HandleScript(), spell_hallows_end_put_costume::HandleScript(), spell_hallows_end_trick_or_treat::HandleScript(), spell_winter_veil_mistletoe::HandleScript(), spell_ayamiss_swarmer_teleport_trigger::HandleScript(), spell_ayamiss_swarmer_start_loop::HandleScript(), spell_moam_summon_mana_fiends::HandleScript(), spell_prince_taldaram_conjure_flame_sphere::HandleScript(), spell_mistress_kiss_area::spell_mistress_kiss_area_SpellScript::HandleScript(), spell_novos_summon_minions::spell_novos_summon_minions_SpellScript::HandleScript(), spell_festergut_gastric_bloat::spell_festergut_gastric_bloat_SpellScript::HandleScript(), spell_putricide_unbound_plague::spell_putricide_unbound_plague_SpellScript::HandleScript(), spell_putricide_choking_gas_bomb::spell_putricide_choking_gas_bomb_SpellScript::HandleScript(), spell_rotface_little_ooze_combine::spell_rotface_little_ooze_combine_SpellScript::HandleScript(), spell_rotface_large_ooze_combine::spell_rotface_large_ooze_combine_SpellScript::HandleScript(), spell_rotface_large_ooze_buff_combine::spell_rotface_large_ooze_buff_combine_SpellScript::HandleScript(), spell_the_lich_king_cast_back_to_caster::spell_the_lich_king_cast_back_to_caster_SpellScript::HandleScript(), spell_frost_giant_death_plague::spell_frost_giant_death_plague_SpellScript::HandleScript(), spell_yogg_saron_target_selectors::spell_yogg_saron_target_selectors_SpellScript::HandleScript(), spell_the_black_stalker_levitate::HandleScript(), spell_the_black_stalker_levitation_pulse::HandleScript(), spell_the_black_stalker_someone_grab_me::HandleScript(), spell_the_black_stalker_magnetic_pull::HandleScript(), spell_the_flag_of_ownership::HandleScript(), spell_gen_elune_candle::HandleScript(), spell_gen_teleporting::HandleScript(), spell_gen_dalaran_disguise::HandleScript(), spell_hun_pet_heart_of_the_phoenix::HandleScript(), spell_item_dimensional_ripper_area52::HandleScript(), spell_item_eggnog::HandleScript(), spell_q12735_song_of_cleansing::HandleScript(), spell_q13011_bear_flank_master::HandleScript(), spell_q12619_emblazon_runeblade_effect::HandleScript(), spell_q12919_gymers_grab::HandleScript(), spell_q12919_gymers_throw::HandleScript(), spell_q12641_death_comes_from_on_high_summon_ghouls::spell_q12641_death_comes_from_on_high_summon_ghouls_SpellScript::HandleScriptEffect(), spell_kalecgos_spectral_realm_dummy::spell_kalecgos_spectral_realm_dummy_SpellScript::HandleScriptEffect(), spell_entropius_negative_energy::spell_entropius_negative_energy_SpellScript::HandleScriptEffect(), spell_marrowgar_coldflame_bonestorm::spell_marrowgar_coldflame_SpellScript::HandleScriptEffect(), spell_yogg_saron_sanity_reduce::spell_yogg_saron_sanity_reduce_SpellScript::HandleScriptEffect(), spell_black_temple_bloodbolt::spell_black_temple_bloodbolt_SpellScript::HandleScriptEffect(), spell_lady_vashj_summon_sporebat::spell_lady_vashj_summon_sporebat_SpellScript::HandleScriptEffect(), spell_kaelthas_summon_weapons::spell_kaelthas_summon_weapons_SpellScript::HandleScriptEffect(), spell_kaelthas_gravity_lapse::spell_kaelthas_gravity_lapse_SpellScript::HandleScriptEffect(), spell_kaelthas_nether_beam::spell_kaelthas_nether_beam_SpellScript::HandleScriptEffect(), spell_gen_clone::HandleScriptEffect(), spell_gen_clone_weapon::HandleScriptEffect(), spell_gen_break_shield::HandleScriptEffect(), spell_gen_mounted_charge::HandleScriptEffect(), spell_gen_throw_shield::HandleScriptEffect(), spell_item_sleepy_willy::HandleScriptEffect(), spell_item_lil_xt::HandleScriptEffect(), spell_q12698_the_gift_that_keeps_on_giving::spell_q12698_the_gift_that_keeps_on_giving_SpellScript::HandleScriptEffect(), spell_death_knight_initiate_visual::HandleScriptEffect(), spell_q12779_an_end_to_all_things::HandleScriptEffect(), spell_brewfest_toss_mug::HandleScriptEffect(), spell_direbrew_summon_mole_machine_target_picker::HandleScriptEffect(), spell_request_second_mug::HandleScriptEffect(), spell_winter_veil_racer_slam_hit::HandleScriptEffect(), spell_winter_veil_shoot_air_rifle::HandleScriptEffect(), spell_dtk_summon_random_drakkari::spell_dtk_summon_random_drakkari_SpellScript::HandleScriptEffect(), spell_marrowgar_coldflame::spell_marrowgar_coldflame_SpellScript::HandleScriptEffect(), spell_arcane_chains_character_force_cast::spell_arcane_chains_character_force_cast_SpellScript::HandleScriptEffect(), spell_q12611_deathbolt::HandleScriptEffect(), spell_illidari_council_judgement::spell_illidari_council_judgement_SpellScript::HandleScriptEffect(), spell_q10612_10613_the_fel_and_the_furious::spell_q10612_10613_the_fel_and_the_furious_SpellScript::HandleScriptEffect(), spell_dk_pestilence::HandleScriptEffect(), spell_hun_masters_call::HandleScriptEffect(), spell_item_mirrens_drinking_hat::HandleScriptEffect(), spell_pal_judgement::HandleScriptEffect(), spell_pri_lightwell::HandleScriptEffect(), spell_q1846_bending_shinbone::HandleScriptEffect(), spell_q14112_14145_chum_the_water::HandleScriptEffect(), WorldSession::HandleSelfResOpcode(), AuraEffect::HandleShapeshiftBoosts(), ArenaSpectator::HandleSpectatorWatchCommand(), HandleSpellClick(), spell_marrowgar_bone_spike_graveyard::spell_marrowgar_bone_spike_graveyard_SpellScript::HandleSpikes(), AuraEffect::HandleSpiritOfRedemption(), spell_gen_paralytic_poison::HandleStun(), spell_putricide_mutated_transformation::spell_putricide_mutated_transformation_SpellScript::HandleSummon(), spell_item_draenic_pale_ale::HandleSummon(), WorldSession::HandleTalentWipeConfirmOpcode(), spell_mother_shahraz_fatal_attraction::spell_mother_shahraz_fatal_attraction_SpellScript::HandleTeleportUnits(), spell_warl_drain_soul::HandleTick(), WorldSession::HandleTrainerBuySpellOpcode(), spell_trigger_spell_from_caster::spell_trigger_spell_from_caster_SpellScript::HandleTrigger(), spell_magic_eater_food::HandleTriggerSpell(), spell_winter_veil_racer_rocket_slam::HandleTriggerSpell(), spell_pal_righteous_defense::HandleTriggerSpellHit(), boss_onyxia::HandleWhelpSpam(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::HealReceived(), boss_ichoron::boss_ichoronAI::IchoronDoCastToAllHostilePlayers(), spell_q10769_dissension_amongst_the_ranks_aura::if(), CharmInfo::InitCharmCreateSpells(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::InitFight(), boss_urok_doomhowl::boss_urok_doomhowlAI::InitializeAI(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::InitializeAI(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::InitializeAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::InitializeAI(), boss_gal_darah::boss_gal_darahAI::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), npc_pet_pri_lightwell::InitializeAI(), CharmInfo::InitPossessCreateSpells(), Guardian::InitStatsForLevel(), Totem::InitSummon(), boss_faction_championsAI::IsCCed(), npc_living_inferno::npc_living_infernoAI::IsSummonedBy(), TriggerAI::IsSummonedBy(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::IsSummonedBy(), npc_bone_spike::npc_bone_spikeAI::IsSummonedBy(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), npc_oculus_drake::npc_oculus_drakeAI::IsSummonedBy(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), npc_pet_gen_fetch_ball::IsSummonedBy(), npc_kiljaeden_controller::npc_kiljaeden_controllerAI::JustDied(), npc_hallows_end_soh::JustDied(), boss_rajaxx::JustDied(), boss_black_knight::boss_black_knightAI::JustDied(), npc_swarm_scarab::npc_swarm_scarabAI::JustDied(), npc_phantom_hallucination::npc_phantom_hallucinationAI::JustDied(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::JustDied(), npc_gunship::npc_gunshipAI::JustDied(), boss_professor_putricide::boss_professor_putricideAI::JustDied(), npc_gluttonous_abomination::npc_gluttonous_abominationAI::JustDied(), npc_boss_gothik_minion::npc_boss_gothik_minionAI::JustDied(), boss_steelbreaker::boss_steelbreakerAI::JustDied(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::JustDied(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::JustDied(), boss_freya_summons::boss_freya_summonsAI::JustDied(), npc_ulduar_saronite_vapors::npc_ulduar_saronite_vaporsAI::JustDied(), boss_yoggsaron_guardian_of_ys::boss_yoggsaron_guardian_of_ysAI::JustDied(), boss_skarvald_the_constructor::boss_skarvald_the_constructorAI::JustDied(), boss_dalronn_the_controller::boss_dalronn_the_controllerAI::JustDied(), npc_ichor_globule::npc_ichor_globuleAI::JustDied(), CombatAI::JustDied(), npc_high_inquisitor_valroth::npc_high_inquisitor_valrothAI::JustDied(), boss_brutallus::boss_brutallusAI::JustDied(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::JustDied(), boss_halion::boss_halionAI::JustDied(), boss_twilight_halion::boss_twilight_halionAI::JustDied(), boss_tharon_ja::boss_tharon_jaAI::JustDied(), boss_razuvious::boss_razuviousAI::JustDied(), boss_sapphiron::boss_sapphironAI::JustDied(), boss_anomalus::boss_anomalusAI::JustDied(), npc_nerubar_victim::npc_nerubar_victimAI::JustDied(), boss_shade_of_akama::boss_shade_of_akamaAI::JustDied(), boss_teron_gorefiend::boss_teron_gorefiendAI::JustDied(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::JustDied(), trigger_death::trigger_deathAI::JustDied(), boss_aeonus::boss_aeonusAI::JustReachedHome(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustReachedHome(), boss_bronjahm::boss_bronjahmAI::JustReachedHome(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustReachedHome(), boss_gal_darah::boss_gal_darahAI::JustReachedHome(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::JustReachedHome(), boss_freya::boss_freyaAI::JustSummoned(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::JustSummoned(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::JustSummoned(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::JustSummoned(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), boss_skeram::JustSummoned(), boss_ichoron::boss_ichoronAI::JustSummoned(), boss_majordomo::boss_majordomoAI::JustSummoned(), boss_ragnaros::boss_ragnarosAI::JustSummoned(), boss_midnight::boss_midnightAI::JustSummoned(), boss_vexallus::boss_vexallusAI::JustSummoned(), boss_kiljaeden::boss_kiljaedenAI::JustSummoned(), npc_kalecgos_kj::npc_kalecgos_kjAI::JustSummoned(), boss_jindo::JustSummoned(), npc_medivh_bm::npc_medivh_bmAI::JustSummoned(), boss_taldaram::JustSummoned(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustSummoned(), boss_halion::boss_halionAI::JustSummoned(), boss_gal_darah::boss_gal_darahAI::JustSummoned(), boss_prince_valanar_icc::boss_prince_valanarAI::JustSummoned(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), npc_icc_putricades_trap::npc_icc_putricades_trapAI::JustSummoned(), boss_malygos::boss_malygosAI::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustSummoned(), boss_svala::boss_svalaAI::JustSummoned(), boss_shirrak_the_dead_watcher::boss_shirrak_the_dead_watcherAI::JustSummoned(), boss_nexusprince_shaffar::boss_nexusprince_shaffarAI::JustSummoned(), boss_grandmaster_vorpil::boss_grandmaster_vorpilAI::JustSummoned(), boss_gurtogg_bloodboil::boss_gurtogg_bloodboilAI::JustSummoned(), boss_illidan_stormrage::boss_illidan_stormrageAI::JustSummoned(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::JustSummoned(), boss_supremus::boss_supremusAI::JustSummoned(), boss_veras_darkshadow::boss_veras_darkshadowAI::JustSummoned(), boss_hydross_the_unstable::boss_hydross_the_unstableAI::JustSummoned(), boss_lady_vashj::boss_lady_vashjAI::JustSummoned(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::JustSummoned(), boss_archimonde::boss_archimondeAI::JustSummoned(), boss_broggok::boss_broggokAI::JustSummoned(), npc_deaths_door_fell_cannon_target_bunny::npc_deaths_door_fell_cannon_target_bunnyAI::JustSummoned(), boss_ayamiss::JustSummoned(), Kill(), boss_azuregos::boss_azuregosAI::KilledUnit(), boss_anubrekhan::boss_anubrekhanAI::KilledUnit(), boss_doomwalker::boss_doomwalkerAI::KilledUnit(), npc_dark_iron_guzzler::KilledUnit(), boss_steelbreaker::boss_steelbreakerAI::KilledUnit(), emerald_dragonAI::KilledUnit(), boss_emeriss::boss_emerissAI::KilledUnit(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::LapseAction(), spell_mandokir_charge::LaunchHit(), Player::learnQuestRewardedSpells(), spell_taldaram_summon_flame_ball::spell_taldaram_summon_flame_ball_SpellScript::Load(), npc_dkc1_gothik::npc_dkc1_gothikAI::MoveInLineOfSight(), npc_scarlet_guard::npc_scarlet_guardAI::MoveInLineOfSight(), npc_fairbanks::npc_fairbanksAI::MoveInLineOfSight(), npc_brewfest_keg_thrower::MoveInLineOfSight(), npc_brewfest_keg_reciver::MoveInLineOfSight(), npc_love_in_air_supply_sentry::MoveInLineOfSight(), npc_love_in_air_snivel::MoveInLineOfSight(), boss_aeonus::boss_aeonusAI::MoveInLineOfSight(), boss_chrono_lord_deja::boss_chrono_lord_dejaAI::MoveInLineOfSight(), boss_temporus::boss_temporusAI::MoveInLineOfSight(), npc_medivh_bm::npc_medivh_bmAI::MoveInLineOfSight(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MoveInLineOfSight(), npc_guardian_pavilion::npc_guardian_pavilionAI::MoveInLineOfSight(), boss_doomwalker::boss_doomwalkerAI::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), npc_spirit_shade::npc_spirit_shadeAI::MovementInform(), boss_selin_fireheart::boss_selin_fireheartAI::MovementInform(), npc_unworthy_initiate::npc_unworthy_initiateAI::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), boss_garfrost::boss_garfrostAI::MovementInform(), boss_eck::boss_eckAI::MovementInform(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::MovementInform(), boss_malygos::boss_malygosAI::MovementInform(), boss_volkhan::boss_volkhanAI::MovementInform(), boss_razorscale::boss_razorscaleAI::MovementInform(), boss_warchief_kargath_bladefist::boss_warchief_kargath_bladefistAI::MovementInform(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::MovementInform(), boss_headless_horseman::MovementInform(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::MovementInform(), gunship_npc_AI::MovementInform(), npc_gunship_boarding_addAI::MovementInform(), npc_gunship_mage::npc_gunship_mageAI::MovementInform(), boss_the_lich_king::boss_the_lich_kingAI::MovementInform(), npc_wild_wyrm::npc_wild_wyrmAI::MovementInform(), boss_kagani_nightstrike::boss_kagani_nightstrikeAI::MovementInform(), npc_dark_iron_guzzler::MovementInform(), npc_hor_lich_king::npc_hor_lich_kingAI::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), npc_assembly_lightning::npc_assembly_lightningAI::MovementInform(), boss_ymiron::boss_ymironAI::MovementInform(), boss_icehowl::boss_icehowlAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::MovementInform(), npc_image_of_medivh::npc_image_of_medivhAI::NextStep(), BattlegroundAB::NodeOccupied(), npc_algalon_worm_hole::npc_algalon_worm_holeAI::npc_algalon_worm_holeAI(), npc_ball_of_flame::npc_ball_of_flameAI::npc_ball_of_flameAI(), npc_collapsing_star::npc_collapsing_starAI::npc_collapsing_starAI(), npc_concentrated_ball::npc_concentrated_ballAI::npc_concentrated_ballAI(), npc_frost_sphere::npc_frost_sphereAI::npc_frost_sphereAI(), npc_frost_tomb::npc_frost_tombAI::npc_frost_tombAI(), npc_hallows_end_soh::npc_hallows_end_soh(), npc_hol_monument::npc_hol_monumentAI::npc_hol_monumentAI(), npc_midsummer_torch_target::npc_midsummer_torch_target(), npc_power_spark::npc_power_sparkAI::npc_power_sparkAI(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::npc_ulduar_iron_constructAI(), npc_ulduar_snow_mound::npc_ulduar_snow_moundAI::npc_ulduar_snow_moundAI(), npc_ulduar_toasty_fire::npc_ulduar_toasty_fireAI::npc_ulduar_toasty_fireAI(), npc_xt002_life_spark::npc_xt002_life_sparkAI::npc_xt002_life_sparkAI(), spell_shadowfang_keep_forsaken_skills::spell_shadowfang_keep_forsaken_skills_AuraScript::OnApply(), spell_direbrew_disarm::OnApply(), spell_love_is_in_the_air_romantic_picnic::OnApply(), spell_halion_combustion_consumption::spell_halion_combustion_consumption_AuraScript::OnApply(), spell_load_into_catapult::spell_load_into_catapult_AuraScript::OnApply(), spell_gen_damage_reduction_aura::OnApply(), spell_gruul_ground_slam_trigger::spell_gruul_ground_slam_trigger_AuraScript::OnApply(), spell_hun_ascpect_of_the_viper::OnApply(), spell_hun_viper_attack_speed::OnApply(), spell_item_with_mount_speed::OnApply(), spell_blood_queen_vampiric_bite::spell_blood_queen_vampiric_bite_SpellScript::OnCast(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), BattlefieldWG::OnCreatureCreate(), instance_sunwell_plateau::instance_sunwell_plateau_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), spell_item_linken_boomerang::OnEffectLaunchTargetDisarm(), spell_item_linken_boomerang::OnEffectLaunchTargetStun(), npc_essence_of_twin::OnGossipHello(), npc_alchemist_adrianna::OnGossipHello(), go_inconspicuous_mine_car::OnGossipHello(), go_noblegarden_colored_egg::OnGossipHello(), go_seer_of_zebhalak::OnGossipHello(), go_jump_a_tron::OnGossipHello(), go_inconspicuous_landmark::OnGossipHello(), go_orb_of_domination::OnGossipHello(), go_scourge_enclosure::OnGossipHello(), go_strange_pool::OnGossipHello(), go_simon_cluster::OnGossipHello(), go_tablet_of_the_seven::OnGossipHello(), go_arcane_prison::OnGossipHello(), go_jotunheim_cage::OnGossipHello(), npc_steward_of_time::OnGossipSelect(), npc_iruk::OnGossipSelect(), npc_zephyr::OnGossipSelect(), npc_taxi::OnGossipSelect(), npc_locksmith::OnGossipSelect(), npc_engineering_tele_trinket::OnGossipSelect(), npc_sayge::OnGossipSelect(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npc_lokhtos_darkbargainer::OnGossipSelect(), boss_gloomrel::OnGossipSelect(), npc_death_knight_initiate::OnGossipSelect(), npc_parqual_fintallas::OnGossipSelect(), npcs_riverbreeze_and_silversky::OnGossipSelect(), npc_braug_dimspirit::OnGossipSelect(), npc_avatar_of_freya::OnGossipSelect(), npc_adventurous_dwarf::OnGossipSelect(), npc_wg_demolisher_engineer::OnGossipSelect(), npc_professor_dabiri::OnGossipSelect(), npcs_ashyen_and_keleth::OnGossipSelect(), npc_innkeeper::OnGossipSelect(), npc_wormhole::OnGossipSelect(), npc_cos_chromie_start::OnGossipSelect(), npc_natrualist_bite::OnGossipSelect(), icecrown_citadel_teleport::OnGossipSelect(), go_midsummer_bonfire::OnGossipSelect(), go_fel_crystalforge::OnGossipSelect(), go_bashir_crystalforge::OnGossipSelect(), go_amberpine_outhouse::OnGossipSelect(), go_apexis_relic::OnGossipSelect(), Player::OnGossipSelect(), lfg::LFGPlayerScript::OnMapChanged(), spell_apothecary_perfume_spill::OnPeriodic(), spell_apothecary_cologne_spill::OnPeriodic(), spell_muru_summon_blood_elves_periodic::spell_muru_summon_blood_elves_periodic_AuraScript::OnPeriodic(), spell_love_is_in_the_air_romantic_picnic::OnPeriodic(), spell_anubisath_mortal_strike::OnPeriodic(), spell_the_lich_king_soul_reaper::spell_the_lich_king_soul_reaper_AuraScript::OnPeriodic(), spell_yogg_saron_brain_link::spell_yogg_saron_brain_link_AuraScript::OnPeriodic(), spell_yogg_saron_empowered::spell_yogg_saron_empowered_AuraScript::OnPeriodic(), spell_illidan_tear_of_azzinoth_summon_channel::spell_illidan_tear_of_azzinoth_summon_channel_AuraScript::OnPeriodic(), spell_illidan_demon_transform1::spell_illidan_demon_transform1_AuraScript::OnPeriodic(), spell_illidan_cage_trap_stun::spell_illidan_cage_trap_stun_AuraScript::OnPeriodic(), spell_black_temple_dementia::spell_black_temple_dementia_AuraScript::OnPeriodic(), spell_npc22275_crystal_prison::spell_npc22275_crystal_prison_AuraScript::OnPeriodic(), spell_muru_darkness::spell_muru_darkness_AuraScript::OnPeriodic(), spell_mark_of_kazrogal::spell_mark_of_kazrogal_AuraScript::OnPeriodic(), spell_the_lich_king_vile_spirits::spell_the_lich_king_vile_spirits_AuraScript::OnPeriodic(), spell_assembly_rune_of_summoning::spell_assembly_rune_of_summoning_AuraScript::OnPeriodic(), spell_thorim_lightning_pillar_P2::spell_thorim_lightning_pillar_P2_AuraScript::OnPeriodic(), spell_illidan_demon_transform2::spell_illidan_demon_transform2_AuraScript::OnPeriodic(), spell_mark_of_kazzak::spell_mark_of_kazzak_AuraScript::OnPeriodic(), spell_karathress_power_of_caribdis::spell_karathress_power_of_caribdis_AuraScript::OnPeriodic(), spell_leotheras_demon_link::spell_leotheras_demon_link_AuraScript::OnPeriodic(), spell_lurker_below_spout::spell_lurker_below_spout_AuraScript::OnPeriodic(), spell_gen_periodic_knock_away::OnPeriodic(), spell_gen_turkey_marker::OnPeriodic(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::OnPlayerEnter(), BattlefieldWG::OnPlayerJoinWar(), spell_gen_obsidian_armor::OnProc(), npc_steward_of_time::OnQuestAccept(), npc_mikhail::OnQuestAccept(), npc_rocknot::OnQuestReward(), npc_thrall_bfu::OnQuestReward(), spell_kalecgos_spectral_realm::spell_kalecgos_spectral_realm_AuraScript::OnRemove(), spell_boss_salramm_steal_flesh::spell_boss_salramm_steal_flesh_AuraScript::OnRemove(), spell_azjol_nerub_web_wrap::spell_azjol_nerub_web_wrap_AuraScript::OnRemove(), spell_putricide_mutation_init::spell_putricide_mutation_init_AuraScript::OnRemove(), spell_the_lich_king_shadow_trap_visual::spell_the_lich_king_shadow_trap_visual_AuraScript::OnRemove(), spell_the_lich_king_harvest_soul::spell_the_lich_king_harvest_soul_AuraScript::OnRemove(), spell_icc_web_wrap::spell_icc_web_wrap_AuraScript::OnRemove(), spell_ioc_repair_turret::spell_ioc_repair_turret_AuraScript::OnRemove(), spell_kaelthas_flame_strike::spell_kaelthas_flame_strike_AuraScript::OnRemove(), spell_item_goblin_weather_machine_aura::OnRemove(), spell_warl_curse_of_doom::OnRemove(), boss_yoggsaron_descend_portal::boss_yoggsaron_descend_portalAI::OnSpellClick(), spell_item_shadowmourne_soul_fragment::OnStackChange(), at_hor_battered_hilt_throw::OnTrigger(), at_frozen_throne_teleport::OnTrigger(), AreaTrigger_at_legion_teleporter::OnTrigger(), AreaTrigger_at_stormwright_shelf::OnTrigger(), AreaTrigger_at_sholazar_waygate::OnTrigger(), npc_wintergarde_gryphon::PassengerBoarded(), npc_four_car_garage::npc_four_car_garageAI::PassengerBoarded(), boss_kologarn::boss_kologarnAI::PassengerBoarded(), npc_frosthound::npc_frosthoundAI::PassengerBoarded(), spell_quest_test_flight_charging::PerformKick(), spell_send_mug_control_aura::PeriodicTick(), spell_barreled_control_aura::PeriodicTick(), spell_dreamwalker_summon_suppresser::spell_dreamwalker_summon_suppresser_AuraScript::PeriodicTick(), spell_halion_twilight_phasing::spell_halion_twilight_phasing_SpellScript::Phase(), Battlefield::PlayerAskToLeave(), BattlegroundAV::PopulateNode(), spell_azjol_nerub_carrion_beetels::PrepareAuraScript(), spell_hodir_flash_freeze::spell_hodir_flash_freeze_AuraScript::PrepareAuraScript(), spell_anti_air_rocket_bomber::spell_anti_air_rocket_bomber_SpellScript::PrepareSpellScript(), spell_charge_shield_bomber::spell_charge_shield_bomber_SpellScript::PrepareSpellScript(), spell_fight_fire_bomber::spell_fight_fire_bomber_SpellScript::PrepareSpellScript(), spell_item_oracle_ablutions::PrepareSpellScript(), spell_q11653_youre_not_so_big_now::PrepareSpellScript(), spell_q13369_fate_up_against_your_will::PrepareSpellScript(), SmartScript::ProcessAction(), ProcessCastaction(), Player::ProcessDelayedOperations(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::ProcessEvent(), ProcessTerrainStatusUpdate(), ProcessUnlearnAction(), BattlefieldWG::PromotePlayer(), spell_gen_defend::RefreshVisualShields(), Vehicle::RemovePassenger(), spell_igb_below_zero::spell_igb_below_zero_SpellScript::RemovePassengers(), boss_keristrasza::boss_keristraszaAI::RemovePrison(), Player::ReportedAfkBy(), GuardAI::Reset(), boss_brutallus::boss_brutallusAI::Reset(), boss_sacrolash::boss_sacrolashAI::Reset(), boss_alythess::boss_alythessAI::Reset(), npc_demonic_vapor::npc_demonic_vaporAI::Reset(), npc_demonic_vapor_trail::npc_demonic_vapor_trailAI::Reset(), boss_kalec::boss_kalecAI::Reset(), boss_sathrovarr::boss_sathrovarrAI::Reset(), npc_kiljaeden_controller::npc_kiljaeden_controllerAI::Reset(), npc_singularity::npc_singularityAI::Reset(), npc_dark_iron_guzzler::Reset(), boss_headless_horseman_pumpkin::Reset(), npc_taretha::npc_tarethaAI::Reset(), npc_medivh_bm::npc_medivh_bmAI::Reset(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::Reset(), boss_halion::boss_halionAI::Reset(), npc_swarm_scarab::npc_swarm_scarabAI::Reset(), npc_nerubian_burrower::npc_nerubian_burrowerAI::Reset(), boss_tharon_ja::boss_tharon_jaAI::Reset(), boss_bronjahm::boss_bronjahmAI::Reset(), boss_drakkari_elemental::boss_drakkari_elementalAI::Reset(), npc_dark_nucleus::npc_dark_nucleusAI::Reset(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::Reset(), boss_sindragosa::boss_sindragosaAI::Reset(), npc_raging_spirit::npc_raging_spiritAI::Reset(), boss_noth::boss_nothAI::Reset(), boss_anomalus::boss_anomalusAI::Reset(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::Reset(), boss_urom::boss_uromAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_bjarngrim::boss_bjarngrimAI::Reset(), boss_algalon_the_observer::boss_algalon_the_observerAI::Reset(), npc_auriaya_sanctum_sentry::npc_auriaya_sanctum_sentryAI::Reset(), boss_flame_leviathan::boss_flame_leviathanAI::Reset(), boss_freya_lifebinder::boss_freya_lifebinderAI::Reset(), boss_freya_healthy_spore::boss_freya_healthy_sporeAI::Reset(), boss_freya_nature_bomb::boss_freya_nature_bombAI::Reset(), boss_thorim_lightning_orb::boss_thorim_lightning_orbAI::Reset(), boss_thorim_sif_blizzard::boss_thorim_sif_blizzardAI::Reset(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::Reset(), boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::Reset(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::Reset(), boss_yoggsaron_voice::boss_yoggsaron_voiceAI::Reset(), boss_palehoof::boss_palehoofAI::Reset(), npc_frozen_orb::npc_frozen_orbAI::Reset(), npc_frozen_orb_stalker::npc_frozen_orb_stalkerAI::Reset(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::Reset(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::Reset(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::Reset(), npc_storm_cloud::npc_storm_cloudAI::Reset(), boss_ambassador_hellmaw::boss_ambassador_hellmawAI::Reset(), boss_illidan_stormrage::boss_illidan_stormrageAI::Reset(), npc_akama_shade::npc_akamaAI::Reset(), boss_teron_gorefiend::boss_teron_gorefiendAI::Reset(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::Reset(), boss_magtheridon::boss_magtheridonAI::Reset(), npc_warden_mellichar::npc_warden_mellicharAI::Reset(), boss_wrath_scryer_soccothrates::boss_wrath_scryer_soccothratesAI::Reset(), boss_laj::boss_lajAI::Reset(), npc_ancestral_wolf::npc_ancestral_wolfAI::Reset(), npc_training_dummy::npc_training_dummyAI::Reset(), BfGraveyard::Resurrect(), Resurrect(), Player::ResurrectPlayer(), Player::RewardQuest(), boss_bjarngrim::boss_bjarngrimAI::RollStance(), boss_supremus::boss_supremusAI::SchedulePhase(), Map::ScriptsProcess(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), npc_anubarak_spike::npc_anubarak_spikeAI::SelectNewTarget(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::SelectT(), npc_sayge::SendAction(), go_skull_pile::SendActionMenu(), npc_xt002_heart::npc_xt002_heartAI::SendEnergyToCorner(), Player::SendInitialPacketsAfterAddToMap(), Player::SendQuestUpdate(), npc_ulduar_harpoonfirestate::npc_ulduar_harpoonfirestateAI::SetData(), npc_eastvale_peasent::SetData(), boss_hydross_the_unstable::boss_hydross_the_unstableAI::SetForm(), SetModelVisible(), npc_your_inner_turmoil::npc_your_inner_turmoilAI::setphase(), npc_simon_bunny::npc_simon_bunnyAI::SetUpPreGame(), npc_stable_master::npc_stable_masterAI::sGossipSelect(), npc_brewfest_keg_reciver::sGossipSelect(), npc_cairne_bloodhoof::npc_cairne_bloodhoofAI::sGossipSelect(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::sGossipSelect(), npc_zafod_boombox::npc_zafod_boomboxAI::sGossipSelect(), npc_crusade_recruit::npc_crusade_recruitAI::sGossipSelect(), boss_hodir::boss_hodirAI::SmallIcicles(), boss_zuljin::boss_zuljinAI::SpawnAdds(), boss_skadi_grauf::boss_skadi_graufAI::SpawnFlameTriggers(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::SpellHit(), boss_eadric::boss_eadricAI::SpellHit(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::SpellHit(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::SpellHit(), npc_ulduar_flames_spread::npc_ulduar_flames_spreadAI::SpellHit(), npc_ichor_globule::npc_ichor_globuleAI::SpellHit(), npc_vics_flying_machine::npc_vics_flying_machineAI::SpellHit(), npc_franklin::npc_franklinAI::SpellHit(), boss_attumen::boss_attumenAI::SpellHit(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::SpellHit(), npc_dark_iron_guzzler::SpellHit(), boss_headless_horseman::SpellHit(), boss_thorim_pillar::boss_thorim_pillarAI::SpellHit(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::SpellHit(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::SpellHit(), boss_jaraxxus::boss_jaraxxusAI::SpellHit(), npc_living_constellation::npc_living_constellationAI::SpellHit(), boss_ignis::boss_ignisAI::SpellHit(), boss_razorscale::boss_razorscaleAI::SpellHit(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::SpellHit(), npc_storm_cloud::npc_storm_cloudAI::SpellHit(), npc_soh_fire_trigger::SpellHit(), boss_headless_horseman_head::SpellHit(), npc_midsummer_torch_target::SpellHit(), boss_magus_telestra::boss_magus_telestraAI::SpellHit(), boss_thorim::boss_thorimAI::SpellHit(), npc_iron_watcher::npc_iron_watcherAI::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), boss_bronjahm::boss_bronjahmAI::SpellHitTarget(), npc_demonic_vapor_trail::npc_demonic_vapor_trailAI::SpellHitTarget(), boss_volkhan::boss_volkhanAI::SpellHitTarget(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), boss_rotface::boss_rotfaceAI::SpellHitTarget(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::SpellHitTarget(), boss_hodir::boss_hodirAI::SpellHitTarget(), npc_ulduar_rocket_strike_trigger::npc_ulduar_rocket_strike_triggerAI::SpellHitTarget(), npc_q24545_lich_king::npc_q24545_lich_kingAI::SpellHitTarget(), boss_epoch::boss_epochAI::SpellHitTarget(), boss_sapphiron::boss_sapphironAI::SpellHitTarget(), boss_skadi_grauf::boss_skadi_graufAI::SpellHitTarget(), boss_shirrak_the_dead_watcher::boss_shirrak_the_dead_watcherAI::SpellHitTarget(), npc_pet_gen_soul_trader_beacon::SpellHitTarget(), boss_ionar::boss_ionarAI::Split(), boss_heigan::boss_heiganAI::StartFightPhase(), npc_finklestein::npc_finklesteinAI::StartNextTask(), boss_ahune::boss_ahuneAI::StartPhase1(), Player::StoreItem(), spell_dk_ghoul_explode::Suicide(), boss_anzu::boss_anzuAI::SummonBroods(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::SummonChannelers(), boss_ahune::boss_ahuneAI::SummonedCreatureDespawn(), boss_anubrekhan::boss_anubrekhanAI::SummonedCreatureDies(), boss_cthun::SummonedCreatureDies(), boss_the_black_stalker::SummonedCreatureDies(), boss_vexallus::boss_vexallusAI::SummonedCreatureDies(), boss_paletress::boss_paletressAI::SummonMemory(), go_wind_stone::go_wind_stoneAI::SummonNPC(), instance_the_black_morass::instance_the_black_morass_InstanceMapScript::SummonPortalKeeper(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), spell_igb_check_for_players::spell_igb_check_for_players_SpellScript::TeleportPlayer(), BattlegroundSA::TeleportToEntrancePosition(), spell_midsummer_fling_torch::ThrowNextTorch(), TriggerBurningPitch(), npc_orb_carrier::npc_orb_carrierAI::TriggerCutter(), spell_koralon_meteor_fists::spell_koralon_meteor_fists_AuraScript::TriggerFists(), spell_flame_warder_meteor_fists::spell_flame_warder_meteor_fists_AuraScript::TriggerFists(), spell_gen_holiday_buff_food::TriggerFoodBuff(), spell_karazhan_brittle_bones::spell_karazhan_brittle_bones_AuraScript::Update(), spell_black_temple_curse_of_the_bleakheart::spell_black_temple_curse_of_the_bleakheart_AuraScript::Update(), spell_mother_shahraz_random_periodic::spell_mother_shahraz_random_periodic_AuraScript::Update(), spell_mother_shahraz_beam_periodic::spell_mother_shahraz_beam_periodic_AuraScript::Update(), spell_mother_shahraz_saber_lash::spell_mother_shahraz_saber_lash_AuraScript::Update(), spell_illidari_council_deadly_strike::spell_illidari_council_deadly_strike_AuraScript::Update(), spell_black_temple_charge_rage::spell_black_temple_charge_rage_AuraScript::Update(), Pet::Update(), GameObject::Update(), npc_razzashi_cobra_venoxis::npc_razzashi_cobra_venoxis_AI::UpdateAI(), TotemAI::UpdateAI(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::UpdateAI(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_curator::boss_curatorAI::UpdateAI(), boss_midnight::boss_midnightAI::UpdateAI(), boss_attumen::boss_attumenAI::UpdateAI(), boss_attumen_midnight::boss_attumen_midnightAI::UpdateAI(), boss_servant_quarters::UpdateAI(), boss_shade_of_aran::boss_aranAI::UpdateAI(), npc_image_of_medivh::npc_image_of_medivhAI::UpdateAI(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::UpdateAI(), boss_priestess_delrissa::boss_priestess_delrissaAI::UpdateAI(), boss_priestess_lackey_commonAI::UpdateAI(), boss_kagani_nightstrike::boss_kagani_nightstrikeAI::UpdateAI(), boss_ellris_duskhallow::boss_ellris_duskhallowAI::UpdateAI(), boss_eramas_brightblaze::boss_eramas_brightblazeAI::UpdateAI(), boss_yazzai::boss_yazzaiAI::UpdateAI(), boss_warlord_salaris::boss_warlord_salarisAI::UpdateAI(), boss_garaxxas::boss_garaxxasAI::UpdateAI(), boss_apoko::boss_apokoAI::UpdateAI(), boss_zelfan::boss_zelfanAI::UpdateAI(), boss_selin_fireheart::boss_selin_fireheartAI::UpdateAI(), boss_vexallus::boss_vexallusAI::UpdateAI(), npc_death_knight_initiate::npc_death_knight_initiateAI::UpdateAI(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_mograine::npc_mograineAI::UpdateAI(), boss_high_inquisitor_whitemane::boss_high_inquisitor_whitemaneAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), boss_brutallus::boss_brutallusAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_sacrolash::boss_sacrolashAI::UpdateAI(), boss_alythess::boss_alythessAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), npc_demonic_vapor_trail::npc_demonic_vapor_trailAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), boss_kalec::boss_kalecAI::UpdateAI(), boss_sathrovarr::boss_sathrovarrAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), npc_kalecgos_kj::npc_kalecgos_kjAI::UpdateAI(), boss_muru::boss_muruAI::UpdateAI(), boss_entropius::boss_entropiusAI::UpdateAI(), npc_singularity::npc_singularityAI::UpdateAI(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::UpdateAI(), npc_partygoer::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), boss_akilzon::boss_akilzonAI::UpdateAI(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::UpdateAI(), boss_fenstalker::boss_fenstalkerAI::UpdateAI(), boss_wushoolay::boss_wushoolayAI::UpdateAI(), npc_dark_iron_guzzler::UpdateAI(), npc_brewfest_super_brew_trigger::UpdateAI(), npc_hallows_end_train_fire::UpdateAI(), boss_headless_horseman::UpdateAI(), boss_headless_horseman_head::UpdateAI(), boss_headless_horseman_pumpkin::UpdateAI(), npc_love_in_air_snivel_real::UpdateAI(), npc_giant_infernal::npc_giant_infernalAI::UpdateAI(), npc_gargoyle::npc_gargoyleAI::UpdateAI(), boss_epoch::boss_epochAI::UpdateAI(), boss_infinite_corruptor::boss_infinite_corruptorAI::UpdateAI(), boss_mal_ganis::boss_mal_ganisAI::UpdateAI(), boss_meathook::boss_meathookAI::UpdateAI(), boss_salramm::boss_salrammAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), boss_captain_skarloc::boss_captain_skarlocAI::UpdateAI(), boss_epoch_hunter::boss_epoch_hunterAI::UpdateAI(), boss_lieutenant_drake::boss_lieutenant_drakeAI::UpdateAI(), boss_aeonus::boss_aeonusAI::UpdateAI(), boss_chrono_lord_deja::boss_chrono_lord_dejaAI::UpdateAI(), boss_temporus::boss_temporusAI::UpdateAI(), npc_medivh_bm::npc_medivh_bmAI::UpdateAI(), npc_time_rift::npc_time_riftAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_skeram::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), npc_tharnarian::npc_tharnarianAI::UpdateAI(), boss_taldaram::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), boss_hadronox::boss_hadronoxAI::UpdateAI(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::UpdateAI(), boss_krik_thir::boss_krik_thirAI::UpdateAI(), boss_sartharion::boss_sartharionAI::UpdateAI(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::UpdateAI(), npc_baltharus_the_warborn_clone::npc_baltharus_the_warborn_cloneAI::UpdateAI(), boss_general_zarithrian::boss_general_zarithrianAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_twilight_halion::boss_twilight_halionAI::UpdateAI(), npc_halion_controller::npc_halion_controllerAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_eadric::boss_eadricAI::UpdateAI(), boss_paletress::boss_paletressAI::UpdateAI(), npc_memory::npc_memoryAI::UpdateAI(), npc_argent_soldier::npc_argent_soldierAI::UpdateAI(), boss_black_knight::boss_black_knightAI::UpdateAI(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::UpdateAI(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_swarm_scarab::npc_swarm_scarabAI::UpdateAI(), npc_frost_sphere::npc_frost_sphereAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_anubarak_spike::npc_anubarak_spikeAI::UpdateAI(), npc_toc_druid::npc_toc_druidAI::UpdateAI(), npc_toc_shaman::npc_toc_shamanAI::UpdateAI(), npc_toc_paladin::npc_toc_paladinAI::UpdateAI(), npc_toc_priest::npc_toc_priestAI::UpdateAI(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::UpdateAI(), npc_toc_warlock::npc_toc_warlockAI::UpdateAI(), npc_toc_mage::npc_toc_mageAI::UpdateAI(), npc_toc_hunter::npc_toc_hunterAI::UpdateAI(), npc_toc_boomkin::npc_toc_boomkinAI::UpdateAI(), npc_toc_warrior::npc_toc_warriorAI::UpdateAI(), npc_toc_dk::npc_toc_dkAI::UpdateAI(), npc_toc_rogue::npc_toc_rogueAI::UpdateAI(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::UpdateAI(), npc_toc_retro_paladin::npc_toc_retro_paladinAI::UpdateAI(), npc_toc_pet_warlock::npc_toc_pet_warlockAI::UpdateAI(), npc_toc_pet_hunter::npc_toc_pet_hunterAI::UpdateAI(), boss_jaraxxus::boss_jaraxxusAI::UpdateAI(), npc_fel_infernal::npc_fel_infernalAI::UpdateAI(), npc_mistress_of_pain::npc_mistress_of_painAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_twin_valkyrAI::UpdateAI(), boss_dred::boss_dredAI::UpdateAI(), boss_novos::boss_novosAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), boss_trollgore::boss_trollgoreAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), npc_fos_corrupted_soul_fragment::npc_fos_corrupted_soul_fragmentAI::UpdateAI(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), boss_falric::boss_falricAI::UpdateAI(), boss_marwyn::boss_marwynAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_ghostly_priest::npc_ghostly_priestAI::UpdateAI(), npc_phantom_mage::npc_phantom_mageAI::UpdateAI(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::UpdateAI(), npc_spectral_footman::npc_spectral_footmanAI::UpdateAI(), npc_tortured_rifleman::npc_tortured_riflemanAI::UpdateAI(), boss_frostsworn_general::boss_frostsworn_generalAI::UpdateAI(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_hor_risen_witch_doctor::npc_hor_risen_witch_doctorAI::UpdateAI(), npc_hor_lumbering_abomination::npc_hor_lumbering_abominationAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::UpdateAI(), npc_pos_icicle_trigger::npc_pos_icicle_triggerAI::UpdateAI(), npc_pos_collapsing_icicle::npc_pos_collapsing_icicleAI::UpdateAI(), npc_pos_leader_second::npc_pos_leader_secondAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), boss_drakkari_elemental::boss_drakkari_elementalAI::UpdateAI(), npc_living_mojo::npc_living_mojoAI::UpdateAI(), boss_eck::boss_eckAI::UpdateAI(), boss_gal_darah::boss_gal_darahAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_slad_ran::boss_slad_ranAI::UpdateAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::UpdateAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), npc_dark_nucleus::npc_dark_nucleusAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::UpdateAI(), boss_festergut::boss_festergutAI::UpdateAI(), npc_stinky_icc::npc_stinky_iccAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_darnavan::npc_darnavanAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), npc_coldflame::npc_coldflameAI::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), npc_big_ooze::npc_big_oozeAI::UpdateAI(), npc_precious_icc::npc_precious_iccAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_spinestalker::npc_spinestalkerAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), npc_spirit_warden::npc_spirit_wardenAI::UpdateAI(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::UpdateAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::UpdateAI(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::UpdateAI(), npc_risen_archmage::npc_risen_archmageAI::UpdateAI(), npc_valithria_cloud::npc_valithria_cloudAI::UpdateAI(), npc_blazing_skeleton::npc_blazing_skeletonAI::UpdateAI(), npc_gluttonous_abomination::npc_gluttonous_abominationAI::UpdateAI(), boss_sister_svalna::boss_sister_svalnaAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), npc_icc_skybreaker_hierophant::npc_icc_skybreaker_hierophantAI::UpdateAI(), npc_icc_skybreaker_marksman::npc_icc_skybreaker_marksmanAI::UpdateAI(), npc_icc_skybreaker_vicar::npc_icc_skybreaker_vicarAI::UpdateAI(), npc_icc_skybreaker_luminary::npc_icc_skybreaker_luminaryAI::UpdateAI(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::UpdateAI(), npc_icc_severed_essence::npc_icc_severed_essenceAI::UpdateAI(), npc_icc_spire_frostwyrm::npc_icc_spire_frostwyrmAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::UpdateAI(), boss_isle_of_conquest::boss_isle_of_conquestAI::UpdateAI(), boss_anubrekhan::boss_anubrekhanAI::UpdateAI(), boss_faerlina::boss_faerlinaAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), npc_boss_gothik_minion::npc_boss_gothik_minionAI::UpdateAI(), boss_grobbulus::boss_grobbulusAI::UpdateAI(), boss_grobbulus_poison_cloud::boss_grobbulus_poison_cloudAI::UpdateAI(), boss_heigan::boss_heiganAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::UpdateAI(), boss_loatheb::boss_loathebAI::UpdateAI(), boss_maexxna::boss_maexxnaAI::UpdateAI(), boss_noth::boss_nothAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_razuvious::boss_razuviousAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_naxxramas_misc::boss_naxxramas_miscAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_power_spark::npc_power_sparkAI::UpdateAI(), npc_nexus_lord::npc_nexus_lordAI::UpdateAI(), npc_scion_of_eternity::npc_scion_of_eternityAI::UpdateAI(), npc_alexstrasza::npc_alexstraszaAI::UpdateAI(), boss_anomalus::boss_anomalusAI::UpdateAI(), boss_commander_stoutbeard::boss_commander_stoutbeardAI::UpdateAI(), boss_keristrasza::boss_keristraszaAI::UpdateAI(), boss_magus_telestra::boss_magus_telestraAI::UpdateAI(), boss_ormorok::boss_ormorokAI::UpdateAI(), npc_crystal_spike::npc_crystal_spikeAI::UpdateAI(), npc_crystalline_frayer::npc_crystalline_frayerAI::UpdateAI(), boss_drakos::boss_drakosAI::UpdateAI(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::UpdateAI(), boss_eregos::boss_eregosAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), npc_stormforged_lieutenant::npc_stormforged_lieutenantAI::UpdateAI(), boss_ionar::boss_ionarAI::UpdateAI(), boss_loken::boss_lokenAI::UpdateAI(), boss_volkhan::boss_volkhanAI::UpdateAI(), npc_molten_golem::npc_molten_golemAI::UpdateAI(), npc_hol_monument::npc_hol_monumentAI::UpdateAI(), boss_krystallus::boss_krystallusAI::UpdateAI(), boss_maiden_of_grief::boss_maiden_of_griefAI::UpdateAI(), boss_sjonnir::boss_sjonnirAI::UpdateAI(), boss_sjonnir_iron_sludge::boss_sjonnir_iron_sludgeAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), npc_algalon_worm_hole::npc_algalon_worm_holeAI::UpdateAI(), boss_steelbreaker::boss_steelbreakerAI::UpdateAI(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_auriaya::boss_auriayaAI::UpdateAI(), npc_auriaya_sanctum_sentry::npc_auriaya_sanctum_sentryAI::UpdateAI(), npc_auriaya_feral_defender::npc_auriaya_feral_defenderAI::UpdateAI(), boss_flame_leviathan::boss_flame_leviathanAI::UpdateAI(), boss_freya::boss_freyaAI::UpdateAI(), boss_freya_elder_stonebark::boss_freya_elder_stonebarkAI::UpdateAI(), boss_freya_elder_brightleaf::boss_freya_elder_brightleafAI::UpdateAI(), boss_freya_elder_ironbranch::boss_freya_elder_ironbranchAI::UpdateAI(), boss_freya_lifebinder::boss_freya_lifebinderAI::UpdateAI(), boss_freya_summons::boss_freya_summonsAI::UpdateAI(), boss_freya_nature_bomb::boss_freya_nature_bombAI::UpdateAI(), boss_vezax::boss_vezaxAI::UpdateAI(), npc_ulduar_saronite_animus::npc_ulduar_saronite_animusAI::UpdateAI(), boss_hodir::boss_hodirAI::UpdateAI(), npc_ulduar_icicle::npc_ulduar_icicleAI::UpdateAI(), npc_ulduar_hodir_priest::npc_ulduar_hodir_priestAI::UpdateAI(), npc_ulduar_hodir_druid::npc_ulduar_hodir_druidAI::UpdateAI(), npc_ulduar_hodir_shaman::npc_ulduar_hodir_shamanAI::UpdateAI(), npc_ulduar_hodir_mage::npc_ulduar_hodir_mageAI::UpdateAI(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), boss_kologarn::boss_kologarnAI::UpdateAI(), boss_kologarn_eyebeam::boss_kologarn_eyebeamAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::UpdateAI(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::UpdateAI(), npc_ulduar_proximity_mine::npc_ulduar_proximity_mineAI::UpdateAI(), npc_ulduar_emergency_fire_bot::npc_ulduar_emergency_fire_botAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), npc_ulduar_dark_rune_guardian::npc_ulduar_dark_rune_guardianAI::UpdateAI(), npc_ulduar_dark_rune_watcher::npc_ulduar_dark_rune_watcherAI::UpdateAI(), npc_ulduar_dark_rune_sentinel::npc_ulduar_dark_rune_sentinelAI::UpdateAI(), boss_thorim::boss_thorimAI::UpdateAI(), boss_thorim_sif::boss_thorim_sifAI::UpdateAI(), boss_thorim_trap::boss_thorim_trapAI::UpdateAI(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::UpdateAI(), boss_thorim_gauntlet_npcs::boss_thorim_gauntlet_npcsAI::UpdateAI(), boss_thorim_runic_colossus::boss_thorim_runic_colossusAI::UpdateAI(), boss_thorim_ancient_rune_giant::boss_thorim_ancient_rune_giantAI::UpdateAI(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), npc_xt002_pummeller::npc_xt002_pummellerAI::UpdateAI(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::UpdateAI(), boss_yoggsaron_guardian_of_ys::boss_yoggsaron_guardian_of_ysAI::UpdateAI(), boss_yoggsaron::boss_yoggsaronAI::UpdateAI(), boss_yoggsaron_death_orb::boss_yoggsaron_death_orbAI::UpdateAI(), boss_yoggsaron_keeper::boss_yoggsaron_keeperAI::UpdateAI(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::UpdateAI(), npc_ulduar_storm_tempered_keeper::npc_ulduar_storm_tempered_keeperAI::UpdateAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), boss_keleseth::boss_kelesethAI::UpdateAI(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::UpdateAI(), boss_skarvald_the_constructor::boss_skarvald_the_constructorAI::UpdateAI(), boss_dalronn_the_controller::boss_dalronn_the_controllerAI::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), npc_massive_jormungar::npc_massive_jormungarAI::UpdateAI(), npc_ferocious_rhino::npc_ferocious_rhinoAI::UpdateAI(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::UpdateAI(), npc_frenzied_worgen::npc_frenzied_worgenAI::UpdateAI(), boss_skadi::boss_skadiAI::UpdateAI(), boss_skadi_grauf::boss_skadi_graufAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_emalon::boss_emalonAI::UpdateAI(), boss_koralon::boss_koralonAI::UpdateAI(), boss_toravon::boss_toravonAI::UpdateAI(), boss_cyanigosa::boss_cyanigosaAI::UpdateAI(), boss_erekem::boss_erekemAI::UpdateAI(), npc_erekem_guard::npc_erekem_guardAI::UpdateAI(), boss_lavanthor::boss_lavanthorAI::UpdateAI(), boss_moragg::boss_moraggAI::UpdateAI(), boss_xevozz::boss_xevozzAI::UpdateAI(), boss_zuramat::boss_zuramatAI::UpdateAI(), npc_vh_teleportation_portal::npc_vh_teleportation_portalAI::UpdateAI(), npc_azure_saboteur::npc_azure_saboteurAI::UpdateAI(), npc_beryl_sorcerer::npc_beryl_sorcererAI::UpdateAI(), npc_thassarian::npc_thassarianAI::UpdateAI(), npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI::UpdateAI(), npc_hourglass_of_eternity::npc_hourglass_of_eternityAI::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), npc_wounded_skirmisher::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::UpdateAI(), npc_jungle_punch_target::npc_jungle_punch_targetAI::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), npc_freed_protodrake::npc_freed_protodrakeAI::UpdateAI(), npc_wg_queue::npc_wg_queueAI::UpdateAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::UpdateAI(), boss_exarch_maladaar::boss_exarch_maladaarAI::UpdateAI(), npc_stolen_soul::npc_stolen_soulAI::UpdateAI(), boss_shirrak_the_dead_watcher::boss_shirrak_the_dead_watcherAI::UpdateAI(), boss_nexusprince_shaffar::boss_nexusprince_shaffarAI::UpdateAI(), boss_talon_king_ikiss::boss_talon_king_ikissAI::UpdateAI(), boss_anzu::boss_anzuAI::UpdateAI(), boss_ambassador_hellmaw::boss_ambassador_hellmawAI::UpdateAI(), boss_blackheart_the_inciter::boss_blackheart_the_inciterAI::UpdateAI(), boss_grandmaster_vorpil::boss_grandmaster_vorpilAI::UpdateAI(), npc_voidtraveler::npc_voidtravelerAI::UpdateAI(), boss_murmur::boss_murmurAI::UpdateAI(), boss_gurtogg_bloodboil::boss_gurtogg_bloodboilAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_mother_shahraz::boss_shahrazAI::UpdateAI(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::UpdateAI(), boss_essence_of_suffering::boss_essence_of_sufferingAI::UpdateAI(), boss_essence_of_desire::boss_essence_of_desireAI::UpdateAI(), boss_essence_of_anger::boss_essence_of_angerAI::UpdateAI(), npc_akama_shade::npc_akamaAI::UpdateAI(), npc_creature_generator_akama::npc_creature_generator_akamaAI::UpdateAI(), boss_supremus::boss_supremusAI::UpdateAI(), boss_teron_gorefiend::boss_teron_gorefiendAI::UpdateAI(), boss_najentus::boss_najentusAI::UpdateAI(), boss_gathios_the_shatterer::boss_gathios_the_shattererAI::UpdateAI(), boss_high_nethermancer_zerevor::boss_high_nethermancer_zerevorAI::UpdateAI(), boss_lady_malande::boss_lady_malandeAI::UpdateAI(), boss_veras_darkshadow::boss_veras_darkshadowAI::UpdateAI(), boss_fathomlord_karathress::boss_fathomlord_karathressAI::UpdateAI(), boss_hydross_the_unstable::boss_hydross_the_unstableAI::UpdateAI(), boss_lady_vashj::boss_lady_vashjAI::UpdateAI(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::UpdateAI(), npc_inner_demon::npc_inner_demonAI::UpdateAI(), boss_the_lurker_below::boss_the_lurker_belowAI::UpdateAI(), boss_morogrim_tidewalker::boss_morogrim_tidewalkerAI::UpdateAI(), boss_ahune::boss_ahuneAI::UpdateAI(), boss_hydromancer_thespia::boss_thespiaAI::UpdateAI(), boss_mekgineer_steamrigger::boss_mekgineer_steamriggerAI::UpdateAI(), npc_steamrigger_mechanic::npc_steamrigger_mechanicAI::UpdateAI(), boss_warlord_kalithresh::boss_warlord_kalithreshAI::UpdateAI(), boss_the_black_stalker::UpdateAI(), boss_gruul::boss_gruulAI::UpdateAI(), boss_high_king_maulgar::boss_high_king_maulgarAI::UpdateAI(), boss_olm_the_summoner::boss_olm_the_summonerAI::UpdateAI(), boss_kiggler_the_crazed::boss_kiggler_the_crazedAI::UpdateAI(), boss_blindeye_the_seer::boss_blindeye_the_seerAI::UpdateAI(), boss_krosh_firehand::boss_krosh_firehandAI::UpdateAI(), boss_broggok::boss_broggokAI::UpdateAI(), boss_kelidan_the_breaker::boss_kelidan_the_breakerAI::UpdateAI(), npc_shadowmoon_channeler::npc_shadowmoon_channelerAI::UpdateAI(), boss_the_maker::boss_the_makerAI::UpdateAI(), boss_omor_the_unscarred::boss_omor_the_unscarredAI::UpdateAI(), boss_nazan::boss_nazanAI::UpdateAI(), boss_vazruden::boss_vazrudenAI::UpdateAI(), boss_watchkeeper_gargolmar::boss_watchkeeper_gargolmarAI::UpdateAI(), boss_magtheridon::boss_magtheridonAI::UpdateAI(), boss_grand_warlock_nethekurse::boss_grand_warlock_nethekurseAI::UpdateAI(), boss_warbringer_omrogg::boss_warbringer_omroggAI::UpdateAI(), boss_warchief_kargath_bladefist::boss_warchief_kargath_bladefistAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_warden_mellichar::npc_warden_mellicharAI::UpdateAI(), boss_dalliah_the_doomsayer::boss_dalliah_the_doomsayerAI::UpdateAI(), boss_harbinger_skyriss::boss_harbinger_skyrissAI::UpdateAI(), boss_wrath_scryer_soccothrates::boss_wrath_scryer_soccothratesAI::UpdateAI(), boss_zereketh_the_unbound::boss_zereketh_the_unboundAI::UpdateAI(), boss_commander_sarannis::boss_commander_sarannisAI::UpdateAI(), boss_high_botanist_freywinn::boss_high_botanist_freywinnAI::UpdateAI(), boss_laj::boss_lajAI::UpdateAI(), boss_thorngrin_the_tender::boss_thorngrin_the_tenderAI::UpdateAI(), boss_warp_splinter::boss_warp_splinterAI::UpdateAI(), boss_alar::boss_alarAI::UpdateAI(), boss_high_astromancer_solarian::boss_high_astromancer_solarianAI::UpdateAI(), boss_kaelthas::boss_kaelthasAI::UpdateAI(), boss_void_reaver::boss_void_reaverAI::UpdateAI(), boss_gatewatcher_gyrokill::boss_gatewatcher_gyrokillAI::UpdateAI(), boss_gatewatcher_iron_hand::boss_gatewatcher_iron_handAI::UpdateAI(), boss_mechano_lord_capacitus::boss_mechano_lord_capacitusAI::UpdateAI(), boss_nethermancer_sepethrea::boss_nethermancer_sepethreaAI::UpdateAI(), npc_ragin_flames::npc_ragin_flamesAI::UpdateAI(), boss_pathaleon_the_calculator::boss_pathaleon_the_calculatorAI::UpdateAI(), adyen_the_lightbringer::adyen_the_lightbringerAI::UpdateAI(), anchorite_karja::anchorite_karjaAI::UpdateAI(), exarch_orelis::exarch_orelisAI::UpdateAI(), socrethar::socretharAI::UpdateAI(), kaylaan_the_lost::kaylaan_the_lostAI::UpdateAI(), npc_invis_infernal_caster::npc_invis_infernal_casterAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_ishanah::ishanahAI::UpdateAI(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::UpdateAI(), npc_pet_gen_soul_trader_beacon::UpdateAI(), npc_pet_gen_argent_pony_bridle::UpdateAI(), npc_pet_gen_target_following_bomb::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), npc_pet_shaman_fire_elemental::UpdateAI(), trigger_periodic::trigger_periodicAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), boss_ichoron::boss_ichoronAI::UpdateAI(), npc_orb_carrier::npc_orb_carrierAI::UpdateAI(), npc_hor_raging_ghoul::npc_hor_raging_ghoulAI::UpdateAI(), npc_gunship_rocketeer::npc_gunship_rocketeerAI::UpdateAI(), npc_suppresser::npc_suppresserAI::UpdateAI(), npc_xt002_life_spark::npc_xt002_life_sparkAI::UpdateAI(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::UpdateAI(), boss_yoggsaron_corruptor_tentacle::boss_yoggsaron_corruptor_tentacleAI::UpdateAI(), npc_q24545_vegard_dummy::npc_q24545_vegard_dummyAI::UpdateAI(), boss_illidari_council::boss_illidari_councilAI::UpdateAI(), Player::UpdateAreaDependentAuras(), Player::UpdateCharmedAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateEscortAI(), boss_bjarngrim::boss_bjarngrimAI::UpdateEscortAI(), brann_bronzebeard::brann_bronzebeardAI::UpdateEscortAI(), boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::UpdateEscortAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::UpdateEscortAI(), npc_akama_illidan::npc_akama_illidanAI::UpdateEscortAI(), npc_isla_starmane::npc_isla_starmaneAI::UpdateEscortAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdatePhase(), Player::UpdateZoneDependentAuras(), GameObject::Use(), Player::VehicleSpellInitialize(), boss_bjarngrim::boss_bjarngrimAI::WaypointReached(), npc_arthas::npc_arthasAI::WaypointReached(), npc_engineer_helice::npc_engineer_heliceAI::WaypointReached(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ CastSpell() [4/7]

SpellCastResult Unit::CastSpell ( Unit victim,
SpellInfo const *  spellInfo,
bool  triggered,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1215{
1216 return CastSpell(victim, spellInfo, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1217}

References CastSpell(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastSpell() [5/7]

SpellCastResult Unit::CastSpell ( Unit victim,
SpellInfo const *  spellInfo,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1220{
1221 SpellCastTargets targets;
1222 targets.SetUnitTarget(victim);
1223 return CastSpell(targets, spellInfo, nullptr, triggerFlags, castItem, triggeredByAura, originalCaster);
1224}

References CastSpell(), and SpellCastTargets::SetUnitTarget().

◆ CastSpell() [6/7]

SpellCastResult Unit::CastSpell ( Unit victim,
uint32  spellId,
bool  triggered,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1198{
1199 return CastSpell(victim, spellId, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1200}

References CastSpell(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastSpell() [7/7]

SpellCastResult Unit::CastSpell ( Unit victim,
uint32  spellId,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1203{
1204 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1205 if (!spellInfo)
1206 {
1207 LOG_ERROR("entities.unit", "CastSpell: unknown spell {} by caster {}", spellId, GetGUID().ToString());
1209 }
1210
1211 return CastSpell(victim, spellInfo, triggerFlags, castItem, triggeredByAura, originalCaster);
1212}

References CastSpell(), Object::GetGUID(), LOG_ERROR, SPELL_FAILED_SPELL_UNAVAILABLE, sSpellMgr, and Position::ToString().

◆ CastStop()

◆ ChangeSeat()

void Unit::ChangeSeat ( int8  seatId,
bool  next = true 
)
19848{
19849 if (!m_vehicle)
19850 return;
19851
19852 if (seatId < 0)
19853 {
19854 seatId = m_vehicle->GetNextEmptySeat(GetTransSeat(), next);
19855 if (seatId < 0)
19856 return;
19857 }
19858 else if (seatId == GetTransSeat() || !m_vehicle->HasEmptySeat(seatId))
19859 return;
19860
19862 if (!m_vehicle->AddPassenger(this, seatId))
19863 ABORT();
19864}
int8 GetNextEmptySeat(int8 seatId, bool next) const
Definition: Vehicle.cpp:235
bool HasEmptySeat(int8 seatId) const
Definition: Vehicle.cpp:218

References ABORT, Vehicle::AddPassenger(), Vehicle::GetNextEmptySeat(), WorldObject::GetTransSeat(), Vehicle::HasEmptySeat(), m_vehicle, and Vehicle::RemovePassenger().

Referenced by _EnterVehicle(), and WorldSession::HandleChangeSeatsOnControlledVehicle().

◆ CleanupBeforeRemoveFromMap()

void Unit::CleanupBeforeRemoveFromMap ( bool  finalCleanup)
15630{
15632 return;
15633
15634 // This needs to be before RemoveFromWorld to make GetCaster() return a valid pointer on aura removal
15636
15637 if (IsInWorld()) // not in world and not being removed atm
15639
15640 ASSERT(GetGUID());
15641
15642 // A unit may be in removelist and not in world, but it is still in grid
15643 // and may have some references during delete
15646
15647 if (finalCleanup)
15648 m_cleanupDone = true;
15649
15650 m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList
15651 CombatStop();
15656 GetMotionMaster()->Clear(false); // remove different non-standard movement generators.
15657}
void KillAllEvents(bool force)
Definition: EventProcessor.cpp:82
void deleteReferences(bool removeFromMap=false)
Definition: HostileRefMgr.cpp:125
void ClearAllThreat()
Definition: ThreatMgr.cpp:418
void CombatStop(bool includingCast=false)
Definition: Unit.cpp:10401
void RemoveAllGameObjects()
Definition: Unit.cpp:6175
void ClearComboPoints()
Definition: Unit.cpp:17009
void ClearComboPointHolders()
Definition: Unit.cpp:17064
HostileRefMgr & getHostileRefMgr()
Definition: Unit.h:2149
void RemoveFromWorld() override
Definition: Unit.cpp:15583
void RemoveAllAuras()
Definition: Unit.cpp:5239
ThreatMgr & GetThreatMgr()
Definition: Unit.h:2145
void Clear(bool reset=true)
Definition: MotionMaster.h:165

References ASSERT, MotionMaster::Clear(), ThreatMgr::ClearAllThreat(), ClearComboPointHolders(), ClearComboPoints(), CombatStop(), HostileRefMgr::deleteReferences(), Object::GetGUID(), getHostileRefMgr(), GetMotionMaster(), GetThreatMgr(), InterruptNonMeleeSpells(), IsDuringRemoveFromWorld(), Object::IsInWorld(), EventProcessor::KillAllEvents(), m_cleanupDone, m_Events, RemoveAllAuras(), RemoveAllGameObjects(), and RemoveFromWorld().

Referenced by CleanupsBeforeDelete().

◆ CleanupsBeforeDelete()

void Unit::CleanupsBeforeDelete ( bool  finalCleanup = true)
overridevirtual

Reimplemented from WorldObject.

15660{
15661 if (GetTransport())
15662 {
15664 SetTransport(nullptr);
15667 }
15668
15669 CleanupBeforeRemoveFromMap(finalCleanup);
15670}
void RemoveMovementFlag(uint32 flag)
Definition: Object.h:321
void Reset()
Definition: Object.h:275
void SetTransport(Transport *t)
Definition: Object.h:593
virtual void RemovePassenger(WorldObject *passenger, bool withAll=false)=0
void CleanupBeforeRemoveFromMap(bool finalCleanup)
Definition: Unit.cpp:15629

References CleanupBeforeRemoveFromMap(), WorldObject::GetTransport(), WorldObject::m_movementInfo, MOVEMENTFLAG_ONTRANSPORT, MovementInfo::RemoveMovementFlag(), Transport::RemovePassenger(), MovementInfo::TransportInfo::Reset(), WorldObject::SetTransport(), and MovementInfo::transport.

Referenced by Player::CleanupsBeforeDelete(), npc_commandscript::HandleNpcAddCommand(), and Map::RemoveAllObjectsInRemoveList().

◆ ClearAllReactives()

void Unit::ClearAllReactives ( )
17073{
17074 for (uint8 i = 0; i < MAX_REACTIVE; ++i)
17075 m_reactiveTimer[i] = 0;
17076
17083}
@ CLASS_HUNTER
Definition: SharedDefines.h:115
@ CLASS_WARRIOR
Definition: SharedDefines.h:113
@ AURA_STATE_DEFENSE
Definition: SharedDefines.h:1264
@ AURA_STATE_HUNTER_PARRY
Definition: SharedDefines.h:1270
uint8 getClass() const
Definition: Unit.h:1426
bool HasAuraState(AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
Definition: Unit.cpp:10507

References AURA_STATE_DEFENSE, AURA_STATE_HUNTER_PARRY, CLASS_HUNTER, CLASS_WARRIOR, ClearComboPoints(), getClass(), Object::GetTypeId(), HasAuraState(), m_reactiveTimer, MAX_REACTIVE, ModifyAuraState(), and TYPEID_PLAYER.

Referenced by Player::ActivateSpec(), npc_mograine::npc_mograineAI::DamageTaken(), and setDeathState().

◆ ClearComboPointHolders()

void Unit::ClearComboPointHolders ( )
17065{
17066 while (!m_ComboPointHolders.empty())
17067 {
17068 (*m_ComboPointHolders.begin())->ClearComboPoints(); // this also removes it from m_comboPointHolders
17069 }
17070}

References ClearComboPoints(), and m_ComboPointHolders.

Referenced by CreatureAI::_EnterEvadeMode(), CleanupBeforeRemoveFromMap(), npc_mograine::npc_mograineAI::DamageTaken(), Player::RemoveFromWorld(), and setDeathState().

◆ ClearComboPoints()

void Unit::ClearComboPoints ( )
17010{
17011 if (!m_comboTarget)
17012 {
17013 return;
17014 }
17015
17016 // remove Premed-like effects
17017 // (NB: this Aura retains the CP while it's active - now that CP have reset, it shouldn't be there anymore)
17019
17020 m_comboPoints = 0;
17023 m_comboTarget = nullptr;
17024}
@ SPELL_AURA_RETAIN_COMBO_POINTS
Definition: SpellAuraDefines.h:211

References m_comboPoints, m_comboTarget, RemoveAurasByType(), RemoveComboPointHolder(), SendComboPoints(), and SPELL_AURA_RETAIN_COMBO_POINTS.

Referenced by Spell::_handle_finish_phase(), CleanupBeforeRemoveFromMap(), ClearAllReactives(), ClearComboPointHolders(), Player::DuelComplete(), Player::RemoveFromWorld(), Player::setDeathState(), and UpdateReactives().

◆ ClearDiminishings()

void Unit::ClearDiminishings ( )
inline
1332{ m_Diminishing.clear(); }

References m_Diminishing.

Referenced by setDeathState().

◆ ClearInCombat()

void Unit::ClearInCombat ( )
13720{
13721 m_CombatTimer = 0;
13723
13724 // Player's state will be cleared in Player::UpdateContestedPvP
13725 if (Creature* creature = ToCreature())
13726 {
13727 if (creature->GetCreatureTemplate() && creature->GetCreatureTemplate()->unit_flags & UNIT_FLAG_IMMUNE_TO_PC)
13728 SetImmuneToPC(true); // set immunity state to the one from db on evade
13729
13732 ReplaceAllDynamicFlags(creature->GetCreatureTemplate()->dynamicflags);
13733
13734 creature->SetAssistanceTimer(0);
13735
13736 // Xinef: will be recalculated at follow movement generator initialization
13737 if (!IsPet() && !IsCharmed())
13738 return;
13739 }
13740 else if (Player* player = ToPlayer())
13741 {
13742 player->UpdatePotionCooldown();
13743 if (player->getClass() == CLASS_DEATH_KNIGHT)
13744 for (uint8 i = 0; i < MAX_RUNES; ++i)
13745 player->SetGracePeriod(i, 0);
13746 }
13747
13748 if (Player* player = this->ToPlayer())
13749 {
13750 sScriptMgr->OnPlayerLeaveCombat(player);
13751 }
13752}
#define MAX_RUNES
Definition: Player.h:399
@ UNIT_STATE_ATTACK_PLAYER
Definition: Unit.h:339
@ UNIT_FLAG_IN_COMBAT
Definition: Unit.h:467
@ UNIT_FLAG_IMMUNE_TO_PC
Definition: Unit.h:456
@ CLASS_DEATH_KNIGHT
Definition: SharedDefines.h:118
void ReplaceAllDynamicFlags(uint32 flag) override
Definition: Unit.h:1326
bool IsCharmed() const
Definition: Unit.h:1871
bool IsPet() const
Definition: Unit.h:1413
void SetImmuneToPC(bool apply, bool keepCombat=false)
Definition: Unit.cpp:13523
void RemoveUnitFlag(UnitFlags flags)
Definition: Unit.h:1482

References CLASS_DEATH_KNIGHT, ClearUnitState(), Object::HasDynamicFlag(), IsCharmed(), IsPet(), m_CombatTimer, MAX_RUNES, RemoveUnitFlag(), ReplaceAllDynamicFlags(), SetImmuneToPC(), sScriptMgr, Object::ToCreature(), Object::ToPlayer(), UNIT_DYNFLAG_TAPPED, UNIT_FLAG_IMMUNE_TO_PC, UNIT_FLAG_IN_COMBAT, and UNIT_STATE_ATTACK_PLAYER.

Referenced by CombatStop(), adyen_the_lightbringer::adyen_the_lightbringerAI::DoAction(), anchorite_karja::anchorite_karjaAI::DoAction(), exarch_orelis::exarch_orelisAI::DoAction(), Player::LoadFromDB(), Update(), and socrethar::socretharAI::UpdateAI().

◆ ClearInPetCombat()

◆ ClearUnitState()

void Unit::ClearUnitState ( uint32  f)
inline
1399{ m_state &= ~f; }

References m_state.

Referenced by Spell::_cast(), HomeMovementGenerator< Creature >::_setTargetLocation(), Attack(), FollowerAI::AttackStart(), npc_dark_nucleus::npc_dark_nucleusAI::AttackStart(), AttackStop(), ClearInCombat(), boss_ayamiss::DamageTaken(), boss_hungarfen::DamageTaken(), boss_thorim::boss_thorimAI::DisableThorim(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), HomeMovementGenerator< Creature >::DoFinalize(), WaypointMovementGenerator< Creature >::DoFinalize(), RandomMovementGenerator< T >::DoFinalize(), FlightPathMovementGenerator::DoFinalize(), FleeingMovementGenerator< T >::DoFinalize(), ConfusedMovementGenerator< T >::DoFinalize(), RandomMovementGenerator< T >::DoUpdate(), FollowMovementGenerator< T >::DoUpdate(), Spell::EffectDistract(), Spell::EffectResurrectPet(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::EnableSara(), boss_ayamiss::EnterEvadeMode(), SmartAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_future_you::npc_future_youAI::EnterEvadeMode(), TimedFleeingMovementGenerator::Finalize(), RotateMovementGenerator::Finalize(), DistractMovementGenerator::Finalize(), AssistanceDistractMovementGenerator::Finalize(), Spell::finish(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), AuraEffect::HandleAuraModSchoolImmunity(), debug_commandscript::HandleDebugUnitStateCommand(), AuraEffect::HandleFeignDeath(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePetCastSpellOpcode(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), SmartAI::MovementInform(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), MotionMaster::MoveTargetedHome(), WaypointMovementGenerator< Creature >::OnArrived(), Creature::ReleaseFocus(), RemoveCharmedBy(), MotionTransport::RemovePassenger(), Player::ResetContestedPvP(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), Player::SetClientControl(), SetControlled(), Creature::setDeathState(), Player::setDeathState(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), Player::SetIsSpectator(), boss_urom::boss_uromAI::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), spell_putricide_ooze_channel::spell_putricide_ooze_channel_SpellScript::StartAttack(), StopMoving(), StopMovingOnCurrentPos(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), npc_dark_nucleus::npc_dark_nucleusAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), and boss_kaelthas::boss_kaelthasAI::UpdateAI().

◆ CombatStart()

void Unit::CombatStart ( Unit target,
bool  initialAggro = true 
)
13542{
13543 // Xinef: Dont allow to start combat with triggers
13544 if (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsTrigger())
13545 return;
13546
13547 if (initialAggro)
13548 {
13549 // Make player victim stand up automatically
13550 if (victim->getStandState() && victim->IsPlayer())
13551 {
13552 victim->SetStandState(UNIT_STAND_STATE_STAND);
13553 }
13554
13555 if (!victim->IsInCombat() && victim->GetTypeId() != TYPEID_PLAYER && !victim->ToCreature()->HasReactState(REACT_PASSIVE) && victim->ToCreature()->IsAIEnabled)
13556 {
13557 if (victim->IsPet())
13558 victim->ToCreature()->AI()->AttackedBy(this); // PetAI has special handler before AttackStart()
13559 else
13560 {
13561 victim->ToCreature()->AI()->AttackStart(this);
13562 // if the target is an NPC with a pet or minion, pet should react.
13563 if (Unit* victimControlledUnit = victim->GetFirstControlled())
13564 {
13565 victimControlledUnit->SetInCombatWith(this);
13566 SetInCombatWith(victimControlledUnit);
13567 victimControlledUnit->AddThreat(this, 0.0f);
13568 }
13569 }
13570
13571 // if unit has an owner, put owner in combat.
13572 if (Unit* victimOwner = victim->GetOwner())
13573 {
13574 if (!(victimOwner->IsInCombatWith(this)))
13575 {
13576 /* warding off to not take over aggro for no reason
13577 Using only AddThreat causes delay in attack */
13578 if (!victimOwner->IsInCombat() && victimOwner->IsAIEnabled)
13579 {
13580 victimOwner->ToCreature()->AI()->AttackStart(this);
13581 }
13582 victimOwner->SetInCombatWith(this);
13583 SetInCombatWith(victimOwner);
13584 victimOwner->AddThreat(this, 0.0f);
13585 }
13586 }
13587 }
13588
13589 bool alreadyInCombat = IsInCombat();
13590
13591 SetInCombatWith(victim);
13592 victim->SetInCombatWith(this);
13593
13594 // Xinef: If pet started combat - put owner in combat
13595 if (!alreadyInCombat && IsInCombat())
13596 {
13597 if (Unit* owner = GetOwner())
13598 {
13599 owner->SetInCombatWith(victim);
13600 victim->SetInCombatWith(owner);
13601 }
13602 }
13603 }
13604
13605 Unit* who = victim->GetCharmerOrOwnerOrSelf();
13606 if (who->GetTypeId() == TYPEID_PLAYER)
13607 SetContestedPvP(who->ToPlayer());
13608
13610 if (player && who->IsPvP() && (who->GetTypeId() != TYPEID_PLAYER || !player->duel || player->duel->Opponent != who))
13611 {
13612 player->UpdatePvP(true);
13614 }
13615}
@ REACT_PASSIVE
Definition: Unit.h:1023
@ UNIT_STAND_STATE_STAND
Definition: Unit.h:53
@ AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT
Definition: SpellDefines.h:67
void UpdatePvP(bool state, bool _override=false)
Definition: PlayerUpdates.cpp:1481
Unit * GetCharmerOrOwnerOrSelf() const
Definition: Unit.h:1848
void SetContestedPvP(Player *attackedPlayer=nullptr, bool lookForNearContestedGuards=true)
Definition: Unit.cpp:17393
bool IsPvP() const
Definition: Unit.h:1517
Unit * GetFirstControlled() const
Definition: Unit.cpp:11035
bool IsInCombat() const
Definition: Unit.h:1688

References Creature::AI(), CreatureAI::AttackedBy(), UnitAI::AttackStart(), AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT, Player::duel, GetCharmerOrOwnerOrSelf(), GetCharmerOrOwnerPlayerOrPlayerItself(), GetFirstControlled(), GetOwner(), getStandState(), Object::GetTypeId(), Creature::HasReactState(), IsAIEnabled, IsInCombat(), IsPet(), Object::IsPlayer(), IsPvP(), Creature::IsTrigger(), REACT_PASSIVE, RemoveAurasWithInterruptFlags(), SetContestedPvP(), SetInCombatWith(), SetStandState(), Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, UNIT_STAND_STATE_STAND, and Player::UpdatePvP().

Referenced by AttackerStateUpdate(), Spell::CheckCast(), DealDamage(), Spell::DoAllEffectOnTarget(), Spell::EffectTaunt(), AssistDelayEvent::Execute(), and boss_shade_of_aran::boss_aranAI::UpdateAI().

◆ CombatStartOnCast()

void Unit::CombatStartOnCast ( Unit target,
bool  initialAggro = true,
uint32  duration = 0 
)
13618{
13619 // Xinef: Dont allow to start combat with triggers
13620 if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsTrigger())
13621 return;
13622
13623 if (initialAggro)
13624 {
13625 SetInCombatWith(target, duration);
13626
13627 // Xinef: If pet started combat - put owner in combat
13628 if (Unit* owner = GetOwner())
13629 owner->SetInCombatWith(target, duration);
13630 }
13631
13632 Unit* who = target->GetCharmerOrOwnerOrSelf();
13633 if (who->GetTypeId() == TYPEID_PLAYER)
13634 SetContestedPvP(who->ToPlayer());
13635
13637 if (player && who->IsPvP() && (who->GetTypeId() != TYPEID_PLAYER || !player->duel || player->duel->Opponent != who))
13638 {
13639 player->UpdatePvP(true);
13641 }
13642}
bool IsTrigger() const
Definition: Creature.h:77

References AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT, Player::duel, GetCharmerOrOwnerOrSelf(), GetCharmerOrOwnerPlayerOrPlayerItself(), GetOwner(), Object::GetTypeId(), IsPvP(), Creature::IsTrigger(), RemoveAurasWithInterruptFlags(), SetContestedPvP(), SetInCombatWith(), Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, and Player::UpdatePvP().

Referenced by Spell::_cast().

◆ CombatStop()

void Unit::CombatStop ( bool  includingCast = false)
10402{
10403 if (includingCast && IsNonMeleeSpellCast(false))
10405
10406 AttackStop();
10408 if (GetTypeId() == TYPEID_PLAYER)
10409 ToPlayer()->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel
10410 ClearInCombat();
10411
10412 // xinef: just in case
10415}
void SendAttackSwingCancelAttack()
Definition: PlayerMisc.cpp:140
bool IsPetInCombat() const
Definition: Unit.h:1691
void ClearInPetCombat()
Definition: Unit.cpp:13754
void RemoveAllAttackers()
Definition: Unit.cpp:10444
void ClearInCombat()
Definition: Unit.cpp:13719
bool AttackStop()
Definition: Unit.cpp:10368

References AttackStop(), ClearInCombat(), ClearInPetCombat(), Object::GetTypeId(), InterruptNonMeleeSpells(), IsNonMeleeSpellCast(), IsPetInCombat(), RemoveAllAttackers(), Player::SendAttackSwingCancelAttack(), Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by CreatureAI::_EnterEvadeMode(), PetAI::_stopAttack(), Player::ActivateTaxiPathTo(), CleanupBeforeRemoveFromMap(), CombatStopWithPets(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_crystalline_frayer::npc_crystalline_frayerAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::DamageTaken(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), npc_calvin_montague::npc_calvin_montagueAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), npc_akama_illidan::npc_akama_illidanAI::DoAction(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), Spell::EffectSanctuary(), boss_sister_svalna::boss_sister_svalnaAI::EnterCombat(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::EnterCombat(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::EnterCombat(), boss_professor_putricide::boss_professor_putricideAI::EnterCombat(), npc_tirion_fordring_tft::npc_tirion_fordringAI::EnterEvadeMode(), GuardAI::EnterEvadeMode(), TotemAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::EnterEvadeMode(), npc_varian_wrynn::npc_varian_wrynnAI::EnterEvadeMode(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), npc_terenas_menethil::npc_terenas_menethilAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), npc_escortAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), hyjalAI::EnterEvadeMode(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::FlyAway(), Aura::HandleAuraSpecificMods(), misc_commandscript::HandleCombatStopCommand(), spell_q11919_q11940_drake_hunt::spell_q11919_q11940_drake_hunt_AuraScript::HandleEffectRemove(), AuraEffect::HandleFeignDeath(), npc_commandscript::HandleNpcDeleteCommand(), Battlefield::HideNpc(), Kill(), boss_urom::boss_uromAI::LeaveCombat(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MySelectNextTarget(), SmartScript::ProcessAction(), Player::RemovePet(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::Reset(), setDeathState(), npc_crusade_persuaded::npc_crusade_persuadedAI::SpellHit(), npc_yenniku::npc_yennikuAI::SpellHit(), npc_venture_co_straggler::npc_venture_co_stragglerAI::SpellHit(), Player::TeleportTo(), Totem::UnSummon(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), npc_yenniku::npc_yennikuAI::UpdateAI(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), npc_frost_freeze_trap::npc_frost_freeze_trapAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), npc_aeranas::npc_aeranasAI::UpdateAI(), socrethar::socretharAI::UpdateAI(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), and npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::UpdateAI().

◆ CombatStopWithPets()

void Unit::CombatStopWithPets ( bool  includingCast = false)
10418{
10419 CombatStop(includingCast);
10420
10421 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
10422 (*itr)->CombatStop(includingCast);
10423}

References CombatStop(), and m_Controlled.

Referenced by DealDamage(), WorldSession::HandleDuelCancelledOpcode(), Player::SetGameMaster(), Player::SetGMVisible(), and Player::UpdateArea().

◆ CountPctFromCurHealth()

uint32 Unit::CountPctFromCurHealth ( int32  pct) const
inline
1450{ return CalculatePct(GetHealth(), pct); }
uint32 GetHealth() const
Definition: Unit.h:1440

References CalculatePct(), and GetHealth().

Referenced by spell_gen_leeching_swarm::spell_gen_leeching_swarm_AuraScript::HandleEffectPeriodic().

◆ CountPctFromMaxHealth()

uint32 Unit::CountPctFromMaxHealth ( int32  pct) const
inline
1449{ return CalculatePct(GetMaxHealth(), pct); }
uint32 GetMaxHealth() const
Definition: Unit.h:1441

References CalculatePct(), and GetMaxHealth().

Referenced by spell_pri_guardian_spirit::Absorb(), spell_rog_cheat_death::Absorb(), spell_pal_ardent_defender::Absorb(), spell_dru_survival_instincts_aura::AfterApply(), spell_dk_anti_magic_shell_self::CalculateAmount(), spell_dk_vampiric_blood::CalculateAmount(), boss_ichoron::boss_ichoronAI::DoAction(), Spell::EffectHeal(), Spell::EffectHealPct(), Spell::EffectResurrect(), Spell::EffectResurrectPet(), Spell::EffectSelfResurrect(), Spell::EffectSummonType(), spell_dk_death_strike::HandleDummy(), spell_hun_last_stand_pet::HandleDummy(), spell_warr_last_stand::HandleDummy(), HandleDummyAuraProc(), spell_alar_ember_blast::spell_alar_ember_blast_SpellScript::HandleForceCast(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_item_blood_draining_enchant::HandleProc(), HandleProcTriggerSpell(), HealthAbovePct(), HealthAbovePctHealed(), HealthBelowPct(), HealthBelowPctDamaged(), boss_midnight::boss_midnightAI::JustSummoned(), boss_harbinger_skyriss::boss_harbinger_skyrissAI::JustSummoned(), boss_hadronox::boss_hadronoxAI::KilledUnit(), Pet::LoadPetFromDB(), boss_vaelastrasz::boss_vaelAI::Reset(), boss_zuljin::boss_zuljinAI::Reset(), npc_draenei_survivor::npc_draenei_survivorAI::Reset(), npc_injured_draenei::npc_injured_draeneiAI::Reset(), boss_murmur::boss_murmurAI::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), npc_voidtraveler::npc_voidtravelerAI::UpdateAI(), and npc_phase_hunter::npc_phase_hunterAI::UpdateAI().

◆ CreateTamedPetFrom() [1/2]

Pet * Unit::CreateTamedPetFrom ( Creature creatureTarget,
uint32  spell_id = 0 
)
17486{
17487 if (GetTypeId() != TYPEID_PLAYER)
17488 return nullptr;
17489
17490 Pet* pet = new Pet(ToPlayer(), HUNTER_PET);
17491
17492 if (!pet->CreateBaseAtCreature(creatureTarget))
17493 {
17494 delete pet;
17495 return nullptr;
17496 }
17497
17498 uint8 level = creatureTarget->GetLevel() + 5 < GetLevel() ? (GetLevel() - 5) : creatureTarget->GetLevel();
17499
17500 if (!InitTamedPet(pet, level, spell_id))
17501 {
17502 delete pet;
17503 return nullptr;
17504 }
17505
17506 return pet;
17507}
@ HUNTER_PET
Definition: PetDefines.h:32
bool CreateBaseAtCreature(Creature *creature)
Definition: Pet.cpp:932
bool InitTamedPet(Pet *pet, uint8 level, uint32 spell_id)
Definition: Unit.cpp:17529

References Pet::CreateBaseAtCreature(), GetLevel(), Object::GetTypeId(), HUNTER_PET, InitTamedPet(), Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by Player::CreatePet(), Spell::EffectCreateTamedPet(), and Spell::EffectTameCreature().

◆ CreateTamedPetFrom() [2/2]

Pet * Unit::CreateTamedPetFrom ( uint32  creatureEntry,
uint32  spell_id = 0 
)
17510{
17511 if (GetTypeId() != TYPEID_PLAYER)
17512 return nullptr;
17513
17514 CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry);
17515 if (!creatureInfo)
17516 return nullptr;
17517
17518 Pet* pet = new Pet(ToPlayer(), HUNTER_PET);
17519
17520 if (!pet->CreateBaseAtCreatureInfo(creatureInfo, this) || !InitTamedPet(pet, GetLevel(), spell_id))
17521 {
17522 delete pet;
17523 return nullptr;
17524 }
17525
17526 return pet;
17527}
bool CreateBaseAtCreatureInfo(CreatureTemplate const *cinfo, Unit *owner)
Definition: Pet.cpp:967

References Pet::CreateBaseAtCreatureInfo(), GetLevel(), Object::GetTypeId(), HUNTER_PET, InitTamedPet(), sObjectMgr, Object::ToPlayer(), and TYPEID_PLAYER.

◆ CreateVehicleKit()

bool Unit::CreateVehicleKit ( uint32  id,
uint32  creatureEntry 
)
18854{
18855 VehicleEntry const* vehInfo = sVehicleStore.LookupEntry(id);
18856 if (!vehInfo)
18857 return false;
18858
18859 m_vehicleKit = new Vehicle(this, vehInfo, creatureEntry);
18862 return true;
18863}
DBCStorage< VehicleEntry > sVehicleStore(VehicleEntryfmt)
@ UPDATEFLAG_VEHICLE
Definition: UpdateData.h:46
@ UNIT_MASK_VEHICLE
Definition: Unit.h:680
Definition: DBCStructure.h:1989

References m_unitTypeMask, Object::m_updateFlag, m_vehicleKit, sVehicleStore, UNIT_MASK_VEHICLE, and UPDATEFLAG_VEHICLE.

Referenced by Creature::CreateFromProto(), AuraEffect::HandleAuraSetVehicle(), Mount(), and npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::SpellHit().

◆ DealDamage()

uint32 Unit::DealDamage ( Unit attacker,
Unit victim,
uint32  damage,
CleanDamage const *  cleanDamage = nullptr,
DamageEffectType  damagetype = DIRECT_DAMAGE,
SpellSchoolMask  damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL,
SpellInfo const *  spellProto = nullptr,
bool  durabilityLoss = true,
bool  allowGM = false,
Spell const *  spell = nullptr 
)
static
816{
817 // Xinef: initialize damage done for rage calculations
818 // Xinef: its rare to modify damage in hooks, however training dummy's sets damage to 0
819 uint32 rage_damage = damage + ((cleanDamage != nullptr) ? cleanDamage->absorbed_damage : 0);
820
821 //if (attacker)
822 {
823 if (victim->IsAIEnabled)
824 victim->GetAI()->DamageTaken(attacker, damage, damagetype, damageSchoolMask);
825
826 if (attacker && attacker->IsAIEnabled)
827 attacker->GetAI()->DamageDealt(victim, damage, damagetype);
828 }
829
830 // Hook for OnDamage Event
831 sScriptMgr->OnDamage(attacker, victim, damage);
832
833 if (victim->GetTypeId() == TYPEID_PLAYER && attacker != victim)
834 {
835 // Signal to pets that their owner was attacked
836 Pet* pet = victim->ToPlayer()->GetPet();
837
838 if (pet && pet->IsAlive())
839 pet->AI()->OwnerAttackedBy(attacker);
840 }
841
842 //Dont deal damage to unit if .cheat god is enable.
843 if (victim->GetTypeId() == TYPEID_PLAYER)
844 {
845 if (victim->ToPlayer()->GetCommandStatus(CHEAT_GOD))
846 {
847 return 0;
848 }
849 }
850
851 // Signal the pet it was attacked so the AI can respond if needed
852 if (victim->GetTypeId() == TYPEID_UNIT && attacker != victim && victim->IsPet() && victim->IsAlive())
853 victim->ToPet()->AI()->AttackedBy(attacker);
854
855 if (damagetype != NODAMAGE)
856 {
857 // interrupting auras with AURA_INTERRUPT_FLAG_DAMAGE before checking !damage (absorbed damage breaks that type of auras)
858 if (spellProto)
859 {
860 if (!spellProto->HasAttribute(SPELL_ATTR4_REACTIVE_DAMAGE_PROC))
862 }
863 else
865
866 // interrupt spells with SPELL_INTERRUPT_FLAG_ABORT_ON_DMG on absorbed damage (no dots)
867 if (!damage && damagetype != DOT && cleanDamage && cleanDamage->absorbed_damage)
868 {
869 if (victim != attacker && victim->GetTypeId() == TYPEID_PLAYER)
870 {
871 if (Spell* spell = victim->m_currentSpells[CURRENT_GENERIC_SPELL])
872 {
873 if (spell->getState() == SPELL_STATE_PREPARING)
874 {
875 uint32 interruptFlags = spell->m_spellInfo->InterruptFlags;
876 if (interruptFlags & SPELL_INTERRUPT_FLAG_ABORT_ON_DMG)
877 {
878 victim->InterruptNonMeleeSpells(false);
879 }
880 }
881 }
882 }
883 }
884
885 // We're going to call functions which can modify content of the list during iteration over it's elements
886 // Let's copy the list so we can prevent iterator invalidation
888 // copy damage to casters of this aura
889 for (AuraEffectList::iterator i = vCopyDamageCopy.begin(); i != vCopyDamageCopy.end(); ++i)
890 {
891 // Check if aura was removed during iteration - we don't need to work on such auras
892 if (!((*i)->GetBase()->IsAppliedOnTarget(victim->GetGUID())))
893 continue;
894 // check damage school mask
895 if (((*i)->GetMiscValue() & damageSchoolMask) == 0)
896 continue;
897
898 Unit* shareDamageTarget = (*i)->GetCaster();
899 if (!shareDamageTarget)
900 continue;
901 SpellInfo const* spell = (*i)->GetSpellInfo();
902
903 uint32 shareDamage = CalculatePct(damage, (*i)->GetAmount());
904
905 uint32 shareAbsorb = 0;
906 uint32 shareResist = 0;
907
908 if (shareDamageTarget->IsImmunedToDamageOrSchool(damageSchoolMask))
909 {
910 shareAbsorb = shareDamage;
911 shareDamage = 0;
912 }
913 else
914 {
915 DamageInfo sharedDamageInfo(attacker, shareDamageTarget, shareDamage, spellProto, damageSchoolMask, damagetype);
916 Unit::CalcAbsorbResist(sharedDamageInfo, true);
917 shareAbsorb = sharedDamageInfo.GetAbsorb();
918 shareResist = sharedDamageInfo.GetResist();
919 shareDamage = sharedDamageInfo.GetDamage();
920 Unit::DealDamageMods(shareDamageTarget, shareDamage, &shareAbsorb);
921 }
922
923 if (attacker && shareDamageTarget->GetTypeId() == TYPEID_PLAYER)
924 {
925 attacker->SendSpellNonMeleeDamageLog(shareDamageTarget, spell, shareDamage, damageSchoolMask, shareAbsorb, shareResist, damagetype == DIRECT_DAMAGE, 0, false, true);
926 }
927
928 Unit::DealDamage(attacker, shareDamageTarget, shareDamage, cleanDamage, NODAMAGE, damageSchoolMask, spellProto, false, false, damageSpell);
929 }
930 }
931
932 // Rage from Damage made (only from direct weapon damage)
933 if (attacker && cleanDamage && damagetype == DIRECT_DAMAGE && attacker != victim && attacker->getPowerType() == POWER_RAGE)
934 {
935 uint32 weaponSpeedHitFactor;
936
937 switch (cleanDamage->attackType)
938 {
939 case BASE_ATTACK:
940 case OFF_ATTACK:
941 {
942 weaponSpeedHitFactor = uint32(attacker->GetAttackTime(cleanDamage->attackType) / 1000.0f * (cleanDamage->attackType == BASE_ATTACK ? 3.5f : 1.75f));
943 if (cleanDamage->hitOutCome == MELEE_HIT_CRIT)
944 weaponSpeedHitFactor *= 2;
945
946 attacker->RewardRage(rage_damage, weaponSpeedHitFactor, true);
947 break;
948 }
949 case RANGED_ATTACK:
950 break;
951 default:
952 break;
953 }
954 }
955
956 if (!damage)
957 {
958 // Rage from absorbed damage
959 if (cleanDamage && cleanDamage->absorbed_damage)
960 {
961 if (victim->getPowerType() == POWER_RAGE)
962 victim->RewardRage(cleanDamage->absorbed_damage, 0, false);
963
964 if (attacker && attacker->getPowerType() == POWER_RAGE )
965 attacker->RewardRage(cleanDamage->absorbed_damage, 0, true);
966 }
967
968 return 0;
969 }
970
971 LOG_DEBUG("entities.unit", "DealDamageStart");
972
973 uint32 health = victim->GetHealth();
974 LOG_DEBUG("entities.unit", "deal dmg:{} to health:{} ", damage, health);
975
976 // duel ends when player has 1 or less hp
977 bool duel_hasEnded = false;
978 bool duel_wasMounted = false;
979 if (victim->GetTypeId() == TYPEID_PLAYER && victim->ToPlayer()->duel && damage >= (health - 1))
980 {
981 // xinef: situation not possible earlier, just return silently.
982 if (!attacker)
983 return 0;
984
985 // prevent kill only if killed in duel and killed by opponent or opponent controlled creature
986 if (victim->ToPlayer()->duel->Opponent == attacker || victim->ToPlayer()->duel->Opponent->GetGUID() == attacker->GetOwnerGUID())
987 damage = health - 1;
988
989 duel_hasEnded = true;
990 }
991 else if (victim->IsVehicle() && damage >= (health - 1) && victim->GetCharmer() && victim->GetCharmer()->GetTypeId() == TYPEID_PLAYER)
992 {
993 Player* victimRider = victim->GetCharmer()->ToPlayer();
994
995 if (victimRider && victimRider->duel && victimRider->duel->IsMounted)
996 {
997 // xinef: situation not possible earlier, just return silently.
998 if (!attacker)
999 return 0;
1000
1001 // prevent kill only if killed in duel and killed by opponent or opponent controlled creature
1002 if (victimRider->duel->Opponent == attacker || victimRider->duel->Opponent->GetGUID() == attacker->GetCharmerGUID())
1003 damage = health - 1;
1004
1005 duel_wasMounted = true;
1006 duel_hasEnded = true;
1007 }
1008 }
1009
1010 if (attacker && attacker != victim)
1011 if (Player* killer = attacker->GetCharmerOrOwnerPlayerOrPlayerItself())
1012 {
1013 // pussywizard: don't allow GMs to deal damage in normal way (this leaves no evidence in logs!), they have commands to do so
1014 //if (!allowGM && killer->GetSession()->GetSecurity() && killer->GetSession()->GetSecurity() <= SEC_ADMINISTRATOR)
1015 // return 0;
1016
1017 if (Battleground* bg = killer->GetBattleground())
1018 {
1019 bg->UpdatePlayerScore(killer, SCORE_DAMAGE_DONE, damage);
1020 killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, damage, 0, victim); // pussywizard: InBattleground() optimization
1021 }
1022 //killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT, damage); // pussywizard: optimization
1023 }
1024
1025 if (victim->GetTypeId() == TYPEID_PLAYER)
1026 ;//victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED, damage); // pussywizard: optimization
1027 else if (!victim->IsControlledByPlayer() || victim->IsVehicle())
1028 {
1029 if (!victim->ToCreature()->hasLootRecipient())
1030 victim->ToCreature()->SetLootRecipient(attacker);
1031
1032 if (!attacker || attacker->IsControlledByPlayer() || attacker->IsCreatedByPlayer())
1033 {
1034 uint32 unDamage = health < damage ? health : damage;
1035 bool damagedByPlayer = unDamage && attacker && (attacker->IsPlayer() || attacker->m_movedByPlayer != nullptr);
1036 victim->ToCreature()->LowerPlayerDamageReq(unDamage, damagedByPlayer);
1037 }
1038 }
1039
1040 if (health <= damage)
1041 {
1042 LOG_DEBUG("entities.unit", "DealDamage: victim just died");
1043
1044 //if (attacker && victim->GetTypeId() == TYPEID_PLAYER && victim != attacker)
1045 //victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, health); // pussywizard: optimization
1046 Unit::Kill(attacker, victim, durabilityLoss, cleanDamage ? cleanDamage->attackType : BASE_ATTACK, spellProto, damageSpell);
1047 }
1048 else
1049 {
1050 LOG_DEBUG("entities.unit", "DealDamageAlive");
1051
1052 //if (victim->GetTypeId() == TYPEID_PLAYER)
1053 // victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, damage); // pussywizard: optimization
1054
1055 victim->ModifyHealth(- (int32)damage);
1056
1057 if (damagetype == DIRECT_DAMAGE || damagetype == SPELL_DIRECT_DAMAGE)
1058 victim->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_DIRECT_DAMAGE, spellProto ? spellProto->Id : 0);
1059
1060 if (victim->GetTypeId() != TYPEID_PLAYER)
1061 {
1062 // Part of Evade mechanics. DoT's and Thorns / Retribution Aura do not contribute to this
1063 if (damagetype != DOT && damage > 0 && !victim->GetOwnerGUID().IsPlayer() && (!spellProto || !spellProto->HasAura(SPELL_AURA_DAMAGE_SHIELD)))
1065
1066 if (attacker)
1067 {
1068 if (spellProto && victim->CanHaveThreatList() && !victim->HasUnitState(UNIT_STATE_EVADE) && !victim->IsInCombatWith(attacker))
1069 {
1070 victim->CombatStart(attacker, !(spellProto->AttributesEx3 & SPELL_ATTR3_SUPRESS_TARGET_PROCS));
1071 }
1072
1073 victim->AddThreat(attacker, float(damage), damageSchoolMask, spellProto);
1074 }
1075 }
1076 else // victim is a player
1077 {
1078 // random durability for items (HIT TAKEN)
1080 {
1083 }
1084 }
1085
1086 // Rage from damage received
1087 if (attacker != victim && victim->getPowerType() == POWER_RAGE)
1088 {
1089 uint32 rageDamage = damage + (cleanDamage ? cleanDamage->absorbed_damage : 0);
1090 victim->RewardRage(rageDamage, 0, false);
1091 }
1092
1093 if (attacker && attacker->GetTypeId() == TYPEID_PLAYER)
1094 {
1095 // random durability for items (HIT DONE)
1097 {
1099 attacker->ToPlayer()->DurabilityPointLossForEquipSlot(slot);
1100 }
1101 }
1102
1103 if (damagetype != NODAMAGE && damage && (!spellProto || !(spellProto->HasAttribute(SPELL_ATTR3_TREAT_AS_PERIODIC) || spellProto->HasAttribute(SPELL_ATTR7_DONT_CAUSE_SPELL_PUSHBACK))))
1104 {
1105 if (victim != attacker && victim->GetTypeId() == TYPEID_PLAYER) // does not support creature push_back
1106 {
1107 if (damagetype != DOT && !(damageSpell && damageSpell->m_targets.HasDstChannel()))
1108 {
1109 if (Spell* spell = victim->m_currentSpells[CURRENT_GENERIC_SPELL])
1110 {
1111 if (spell->getState() == SPELL_STATE_PREPARING)
1112 {
1113 uint32 interruptFlags = spell->m_spellInfo->InterruptFlags;
1114 if (interruptFlags & SPELL_INTERRUPT_FLAG_ABORT_ON_DMG)
1115 {
1116 victim->InterruptNonMeleeSpells(false);
1117 }
1118 else if (interruptFlags & SPELL_INTERRUPT_FLAG_PUSH_BACK)
1119 {
1120 spell->Delayed();
1121 }
1122 }
1123 }
1124
1125 if (Spell* spell = victim->m_currentSpells[CURRENT_CHANNELED_SPELL])
1126 if (spell->getState() == SPELL_STATE_CASTING)
1127 {
1128 if ((spell->m_spellInfo->ChannelInterruptFlags & CHANNEL_FLAG_DELAY) != 0)
1129 {
1130 spell->DelayedChannel();
1131 }
1132 }
1133 }
1134 }
1135 }
1136
1137 // last damage from duel opponent
1138 if (duel_hasEnded)
1139 {
1140 Player* he = duel_wasMounted ? victim->GetCharmer()->ToPlayer() : victim->ToPlayer();
1141
1142 ASSERT_NODEBUGINFO(he && he->duel);
1143
1144 if (duel_wasMounted) // In this case victim==mount
1145 victim->SetHealth(1);
1146 else
1147 he->SetHealth(1);
1148
1149 he->duel->Opponent->CombatStopWithPets(true);
1150 he->CombatStopWithPets(true);
1151
1152 he->CastSpell(he, 7267, true); // beg
1154 }
1155 }
1156
1157 LOG_DEBUG("entities.unit", "DealDamageEnd returned {} damage", damage);
1158
1159 return damage;
1160}
#define ASSERT_NODEBUGINFO
Definition: Errors.h:69
bool roll_chance_f(float chance)
Definition: Random.h:53
@ SCORE_DAMAGE_DONE
Definition: BattlegroundScore.h:33
#define MAX_AGGRO_RESET_TIME
Definition: CreatureData.h:32
@ CHEAT_GOD
Definition: Player.h:991
EquipmentSlots
Definition: Player.h:674
@ EQUIPMENT_SLOT_END
Definition: Player.h:695
@ CURRENT_CHANNELED_SPELL
Definition: Unit.h:980
@ CURRENT_GENERIC_SPELL
Definition: Unit.h:979
@ NODAMAGE
Definition: Unit.h:439
@ SPELL_AURA_DAMAGE_SHIELD
Definition: SpellAuraDefines.h:78
@ SPELL_AURA_SHARE_DAMAGE_PCT
Definition: SpellAuraDefines.h:363
@ SPELL_STATE_PREPARING
Definition: Spell.h:224
@ SPELL_STATE_CASTING
Definition: Spell.h:225
@ CHANNEL_FLAG_DELAY
Definition: SpellDefines.h:39
@ AURA_INTERRUPT_FLAG_TAKE_DAMAGE
Definition: SpellDefines.h:45
@ AURA_INTERRUPT_FLAG_DIRECT_DAMAGE
Definition: SpellDefines.h:68
@ SPELL_INTERRUPT_FLAG_ABORT_ON_DMG
Definition: SpellDefines.h:31
@ SPELL_INTERRUPT_FLAG_PUSH_BACK
Definition: SpellDefines.h:28
@ RATE_DURABILITY_LOSS_DAMAGE
Definition: IWorld.h:502
@ ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE
Definition: DBCEnums.h:136
@ POWER_RAGE
Definition: SharedDefines.h:242
@ SPELL_ATTR7_DONT_CAUSE_SPELL_PUSHBACK
Definition: SharedDefines.h:619
@ SPELL_ATTR3_TREAT_AS_PERIODIC
Definition: SharedDefines.h:490
@ SPELL_ATTR3_SUPRESS_TARGET_PROCS
Definition: SharedDefines.h:482
@ DUEL_WON
Definition: SharedDefines.h:3585
@ SPELL_ATTR4_REACTIVE_DAMAGE_PROC
Definition: SharedDefines.h:516
virtual void DamageTaken(Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
Definition: UnitAI.h:341
virtual void DamageDealt(Unit *, uint32 &, DamageEffectType)
Definition: UnitAI.h:336
virtual void OwnerAttackedBy(Unit *)
Definition: CreatureAI.h:165
virtual void AttackedBy(Unit *)
Definition: CreatureAI.h:142
void SetLootRecipient(Unit *unit, bool withGroup=true)
Definition: Creature.cpp:1283
void SetLastDamagedTime(time_t val)
Definition: Creature.cpp:3564
void LowerPlayerDamageReq(uint32 unDamage, bool damagedByPlayer=true)
Definition: Creature.cpp:3670
CreatureAI * AI() const
Definition: Creature.h:135
bool IsPlayer() const
Definition: ObjectGuid.h:170
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
Definition: PlayerUpdates.cpp:2128
void DurabilityPointLossForEquipSlot(EquipmentSlots slot)
Definition: Player.cpp:4719
Pet * GetPet() const
Definition: Player.cpp:8780
bool GetCommandStatus(uint32 command) const
Definition: Player.h:1154
int32 ModifyHealth(int32 val)
Definition: Unit.cpp:13998
Pet * ToPet()
Definition: Unit.h:2398
bool IsCreatedByPlayer() const
Definition: Unit.h:1829
Unit * GetCharmer() const
Definition: Unit.cpp:10568
static void Kill(Unit *killer, Unit *victim, bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
Definition: Unit.cpp:17836
void RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
Definition: Unit.cpp:20263
void SetHealth(uint32 val)
Definition: Unit.cpp:15365
UnitAI * GetAI()
Definition: Unit.h:1316
ObjectGuid GetCharmerGUID() const
Definition: Unit.h:1820
Powers getPowerType() const
Definition: Unit.h:1459
void CombatStopWithPets(bool includingCast=false)
Definition: Unit.cpp:10417
uint32 ChannelInterruptFlags
Definition: SpellInfo.h:352
uint32 InterruptFlags
Definition: SpellInfo.h:350

References CleanDamage::absorbed_damage, ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, AddThreat(), Creature::AI(), ASSERT_NODEBUGINFO, CreatureAI::AttackedBy(), CleanDamage::attackType, SpellInfo::AttributesEx3, AURA_INTERRUPT_FLAG_DIRECT_DAMAGE, AURA_INTERRUPT_FLAG_TAKE_DAMAGE, BASE_ATTACK, CalcAbsorbResist(), CalculatePct(), CanHaveThreatList(), CastSpell(), CHANNEL_FLAG_DELAY, CHEAT_GOD, CombatStart(), CombatStopWithPets(), CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, UnitAI::DamageDealt(), UnitAI::DamageTaken(), DealDamage(), DealDamageMods(), DIRECT_DAMAGE, DOT, Player::duel, DUEL_WON, Player::DuelComplete(), Player::DurabilityPointLossForEquipSlot(), EQUIPMENT_SLOT_END, DamageInfo::GetAbsorb(), GetAI(), GetAttackTime(), GetAuraEffectsByType(), GetCharmer(), GetCharmerGUID(), GetCharmerOrOwnerPlayerOrPlayerItself(), Player::GetCommandStatus(), DamageInfo::GetDamage(), GameTime::GetGameTime(), Object::GetGUID(), GetHealth(), GetOwnerGUID(), Player::GetPet(), getPowerType(), DamageInfo::GetResist(), Object::GetTypeId(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), SpellCastTargets::HasDstChannel(), Creature::hasLootRecipient(), HasUnitState(), CleanDamage::hitOutCome, SpellInfo::Id, InterruptNonMeleeSpells(), IsAIEnabled, IsAlive(), IsControlledByPlayer(), IsCreatedByPlayer(), IsImmunedToDamageOrSchool(), IsInCombatWith(), IsPet(), Object::IsPlayer(), ObjectGuid::IsPlayer(), IsVehicle(), Kill(), LOG_DEBUG, Creature::LowerPlayerDamageReq(), m_currentSpells, m_movedByPlayer, Spell::m_targets, MAX_AGGRO_RESET_TIME, MELEE_HIT_CRIT, ModifyHealth(), NODAMAGE, OFF_ATTACK, CreatureAI::OwnerAttackedBy(), POWER_RAGE, RANGED_ATTACK, RATE_DURABILITY_LOSS_DAMAGE, RemoveAurasWithInterruptFlags(), RewardRage(), roll_chance_f(), SCORE_DAMAGE_DONE, SendSpellNonMeleeDamageLog(), SetHealth(), Creature::SetLastDamagedTime(), Creature::SetLootRecipient(), SPELL_ATTR3_SUPRESS_TARGET_PROCS, SPELL_ATTR3_TREAT_AS_PERIODIC, SPELL_ATTR4_REACTIVE_DAMAGE_PROC, SPELL_ATTR7_DONT_CAUSE_SPELL_PUSHBACK, SPELL_AURA_DAMAGE_SHIELD, SPELL_AURA_SHARE_DAMAGE_PCT, SPELL_DIRECT_DAMAGE, SPELL_INTERRUPT_FLAG_ABORT_ON_DMG, SPELL_INTERRUPT_FLAG_PUSH_BACK, SPELL_STATE_CASTING, SPELL_STATE_PREPARING, sScriptMgr, sWorld, Object::ToCreature(), ToPet(), Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, UNIT_STATE_EVADE, Player::UpdateAchievementCriteria(), and urand().

Referenced by CalcAbsorbResist(), DealDamage(), DealMeleeDamage(), DealSpellDamage(), npc_the_scourge_cauldron::npc_the_scourge_cauldronAI::DoDie(), Spell::EffectInstaKill(), Player::EnvironmentalDamage(), spell_mt_phoenix_burn::spell_mt_phoenix_burn_SpellScript::HandleAfterCast(), misc_commandscript::HandleDamageCommand(), misc_commandscript::HandleDieCommand(), spell_svala_ritual_strike::spell_svala_ritual_strike_SpellScript::HandleDummyEffect(), spell_alar_ember_blast::spell_alar_ember_blast_SpellScript::HandleForceCast(), spell_algalon_collapse::spell_algalon_collapse_AuraScript::HandlePeriodic(), spell_kaelthas_burn::spell_kaelthas_burn_AuraScript::HandlePeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), spell_gluth_decimate::spell_gluth_decimate_SpellScript::HandleScriptEffect(), boss_akilzon::boss_akilzonAI::HandleStormSequence(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::JustDied(), npc_enslaved_netherwing_drake::npc_enslaved_netherwing_drakeAI::MovementInform(), spell_valkyr_touch::spell_valkyr_touchAuraScript::PrepareAuraScript(), npc_hor_lich_king::npc_hor_lich_kingAI::SpellHitTarget(), boss_archimonde::boss_archimondeAI::UpdateAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), and Player::UpdateCharmedAI().

◆ DealDamageMods()

◆ DealHeal()

int32 Unit::DealHeal ( Unit healer,
Unit victim,
uint32  addhealth 
)
static
10912{
10913 int32 gain = 0;
10914
10915 if (healer)
10916 {
10917 if (victim->IsAIEnabled)
10918 victim->GetAI()->HealReceived(healer, addhealth);
10919
10920 if (healer->IsAIEnabled)
10921 healer->GetAI()->HealDone(victim, addhealth);
10922 }
10923
10924 if (addhealth)
10925 gain = victim->ModifyHealth(int32(addhealth));
10926
10927 // Hook for OnHeal Event
10928 sScriptMgr->OnHeal(healer, victim, (uint32&)gain);
10929
10930 Unit* unit = healer;
10931
10932 if (healer && healer->GetTypeId() == TYPEID_UNIT && healer->ToCreature()->IsTotem())
10933 unit = healer->GetOwner();
10934
10935 if (!unit)
10936 return gain;
10937
10938 if (Player* player = unit->ToPlayer())
10939 {
10940 if (Battleground* bg = player->GetBattleground())
10941 bg->UpdatePlayerScore(player, SCORE_HEALING_DONE, gain);
10942
10943 // use the actual gain, as the overheal shall not be counted, skip gain 0 (it ignored anyway in to criteria)
10944 if (gain && player->InBattleground()) // pussywizard: InBattleground() optimization
10945 player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, gain, 0, victim);
10946
10947 //player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEAL_CASTED, addhealth); // pussywizard: optimization
10948 }
10949
10950 /*if (Player* player = victim->ToPlayer())
10951 {
10952 //player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED, gain); // pussywizard: optimization
10953 //player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED, addhealth); // pussywizard: optimization
10954 }*/
10955
10956 return gain;
10957}
@ SCORE_HEALING_DONE
Definition: BattlegroundScore.h:34
@ ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE
Definition: DBCEnums.h:175
virtual void HealReceived(Unit *, uint32 &)
Definition: UnitAI.h:344
virtual void HealDone(Unit *, uint32 &)
Definition: UnitAI.h:347

References ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, GetAI(), GetOwner(), Object::GetTypeId(), UnitAI::HealDone(), UnitAI::HealReceived(), IsAIEnabled, IsTotem(), ModifyHealth(), SCORE_HEALING_DONE, sScriptMgr, Object::ToCreature(), Object::ToPlayer(), and TYPEID_UNIT.

Referenced by AuraEffect::HandlePeriodicHealAurasTick(), HealBySpell(), and npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI().

◆ DealMeleeDamage()

void Unit::DealMeleeDamage ( CalcDamageInfo damageInfo,
bool  durabilityLoss 
)
1822{
1823 Unit* victim = damageInfo->target;
1824
1825 auto canTakeMeleeDamage = [&]()
1826 {
1827 return victim->IsAlive() && !victim->HasUnitState(UNIT_STATE_IN_FLIGHT) && (victim->GetTypeId() != TYPEID_UNIT || !victim->ToCreature()->IsEvadingAttacks());
1828 };
1829
1830 if (!canTakeMeleeDamage())
1831 {
1832 return;
1833 }
1834
1835 // Hmmmm dont like this emotes client must by self do all animations
1836 if (damageInfo->HitInfo & HITINFO_CRITICALHIT)
1838 if (damageInfo->blocked_amount && damageInfo->TargetState != VICTIMSTATE_BLOCKS)
1840
1841 if (damageInfo->TargetState == VICTIMSTATE_PARRY)
1842 {
1843 // Get attack timers
1844 float offtime = float(victim->getAttackTimer(OFF_ATTACK));
1845 float basetime = float(victim->getAttackTimer(BASE_ATTACK));
1846 // Reduce attack time
1847 if (victim->haveOffhandWeapon() && offtime < basetime)
1848 {
1849 float percent20 = victim->GetAttackTime(OFF_ATTACK) * 0.20f;
1850 float percent60 = 3.0f * percent20;
1851 if (offtime > percent20 && offtime <= percent60)
1852 victim->setAttackTimer(OFF_ATTACK, uint32(percent20));
1853 else if (offtime > percent60)
1854 {
1855 offtime -= 2.0f * percent20;
1856 victim->setAttackTimer(OFF_ATTACK, uint32(offtime));
1857 }
1858 }
1859 else
1860 {
1861 float percent20 = victim->GetAttackTime(BASE_ATTACK) * 0.20f;
1862 float percent60 = 3.0f * percent20;
1863 if (basetime > percent20 && basetime <= percent60)
1864 victim->setAttackTimer(BASE_ATTACK, uint32(percent20));
1865 else if (basetime > percent60)
1866 {
1867 basetime -= 2.0f * percent20;
1868 victim->setAttackTimer(BASE_ATTACK, uint32(basetime));
1869 }
1870 }
1871 }
1872
1873 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1874 {
1875 if (!canTakeMeleeDamage() || (!damageInfo->damages[i].damage && !damageInfo->damages[i].absorb && !damageInfo->damages[i].resist))
1876 {
1877 continue;
1878 }
1879
1880 // Call default DealDamage
1881 CleanDamage cleanDamage(damageInfo->cleanDamage, damageInfo->damages[i].absorb, damageInfo->attackType, damageInfo->hitOutCome);
1882 Unit::DealDamage(this, victim, damageInfo->damages[i].damage, &cleanDamage, DIRECT_DAMAGE, SpellSchoolMask(damageInfo->damages[i].damageSchoolMask), nullptr, durabilityLoss);
1883 }
1884
1885 // If this is a creature and it attacks from behind it has a probability to daze it's victim
1886 if ((damageInfo->damages[0].damage + damageInfo->damages[1].damage) && ((damageInfo->hitOutCome == MELEE_HIT_CRIT || damageInfo->hitOutCome == MELEE_HIT_CRUSHING || damageInfo->hitOutCome == MELEE_HIT_NORMAL || damageInfo->hitOutCome == MELEE_HIT_GLANCING) &&
1887 GetTypeId() != TYPEID_PLAYER && !ToCreature()->IsControlledByPlayer() && !victim->HasInArc(M_PI, this)
1888 && (victim->GetTypeId() == TYPEID_PLAYER || !victim->ToCreature()->isWorldBoss()) && !victim->IsVehicle()))
1889 {
1890 // -probability is between 0% and 40%
1891 // 20% base chance
1892 float Probability = 20.0f;
1893
1894 // there is a newbie protection, at level 10 just 7% base chance; assuming linear function
1895 if (victim->GetLevel() < 30)
1896 Probability = 0.65f * victim->GetLevel() + 0.5f;
1897
1898 uint32 VictimDefense = victim->GetDefenseSkillValue();
1899 uint32 AttackerMeleeSkill = GetUnitMeleeSkill();
1900
1901 // xinef: fix daze mechanics
1902 Probability -= ((float)VictimDefense - AttackerMeleeSkill) * 0.1428f;
1903
1904 if (Probability > 40.0f)
1905 Probability = 40.0f;
1906
1907 if (roll_chance_f(std::max(0.0f, Probability)))
1908 CastSpell(victim, 1604, true);
1909 }
1910
1911 if (GetTypeId() == TYPEID_PLAYER)
1912 ToPlayer()->CastItemCombatSpell(victim, damageInfo->attackType, damageInfo->procVictim, damageInfo->procEx);
1913
1914 // Do effect if any damage done to target
1915 if (damageInfo->damages[0].damage + damageInfo->damages[1].damage)
1916 {
1917 // We're going to call functions which can modify content of the list during iteration over it's elements
1918 // Let's copy the list so we can prevent iterator invalidation
1920 for (AuraEffectList::const_iterator dmgShieldItr = vDamageShieldsCopy.begin(); dmgShieldItr != vDamageShieldsCopy.end(); ++dmgShieldItr)
1921 {
1922 SpellInfo const* i_spellProto = (*dmgShieldItr)->GetSpellInfo();
1923 // Damage shield can be resisted...
1924 if (SpellMissInfo missInfo = victim->SpellHitResult(this, i_spellProto, false))
1925 {
1926 victim->SendSpellMiss(this, i_spellProto->Id, missInfo);
1927 continue;
1928 }
1929
1930 // ...or immuned
1931 if (IsImmunedToDamageOrSchool(i_spellProto))
1932 {
1933 victim->SendSpellDamageImmune(this, i_spellProto->Id);
1934 continue;
1935 }
1936
1937 uint32 damage = uint32(std::max(0, (*dmgShieldItr)->GetAmount())); // xinef: done calculated at amount calculation
1938
1939 if (Unit* caster = (*dmgShieldItr)->GetCaster())
1940 {
1941 damage = caster->SpellDamageBonusDone(this, i_spellProto, damage, SPELL_DIRECT_DAMAGE, (*dmgShieldItr)->GetEffIndex());
1942 damage = this->SpellDamageBonusTaken(caster, i_spellProto, damage, SPELL_DIRECT_DAMAGE);
1943 }
1944
1945 uint32 absorb = 0;
1946
1947 DamageInfo dmgInfo(victim, this, damage, i_spellProto, i_spellProto->GetSchoolMask(), SPELL_DIRECT_DAMAGE);
1948 Unit::CalcAbsorbResist(dmgInfo);
1949 absorb = dmgInfo.GetAbsorb();
1950 damage = dmgInfo.GetDamage();
1951
1952 Unit::DealDamageMods(this, damage, &absorb);
1953
1954 // TODO: Move this to a packet handler
1955 WorldPacket data(SMSG_SPELLDAMAGESHIELD, (8 + 8 + 4 + 4 + 4 + 4));
1956 data << victim->GetGUID();
1957 data << GetGUID();
1958 data << uint32(i_spellProto->Id);
1959 data << uint32(damage); // Damage
1960 int32 overkill = int32(damage) - int32(GetHealth());
1961 data << uint32(overkill > 0 ? overkill : 0); // Overkill
1962 data << uint32(i_spellProto->GetSchoolMask());
1963 victim->SendMessageToSet(&data, true);
1964
1965 Unit::DealDamage(victim, this, damage, 0, SPELL_DIRECT_DAMAGE, i_spellProto->GetSchoolMask(), i_spellProto, true);
1966 }
1967 }
1968}
@ EMOTE_ONESHOT_WOUND_CRITICAL
Definition: SharedDefines.h:1896
@ EMOTE_ONESHOT_PARRY_SHIELD
Definition: SharedDefines.h:1902
SpellMissInfo
Definition: SharedDefines.h:1490
@ SMSG_SPELLDAMAGESHIELD
Definition: Opcodes.h:621
bool isWorldBoss() const
Definition: Creature.h:115
bool HasInArc(float arcangle, const Position *pos, float targetRadius=0.0f) const
Definition: Position.cpp:140
void CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx)
Definition: Player.cpp:7089
uint32 GetUnitMeleeSkill(Unit const *target=nullptr) const
Definition: Unit.h:1636
void SendSpellMiss(Unit *target, uint32 spellID, SpellMissInfo missInfo)
Definition: Unit.cpp:6357
uint32 GetDefenseSkillValue(Unit const *target=nullptr) const
Definition: Unit.cpp:3578
void SendSpellDamageImmune(Unit *target, uint32 spellId)
Definition: Unit.cpp:6381
SpellMissInfo SpellHitResult(Unit *victim, SpellInfo const *spell, bool canReflect=false)
Definition: Unit.cpp:3424
uint32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1)
Definition: Unit.cpp:11714
void HandleEmoteCommand(uint32 emoteId)
Definition: Unit.cpp:1970
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:1972

References CalcDamageInfo::absorb, CalcDamageInfo::attackType, BASE_ATTACK, CalcDamageInfo::blocked_amount, CalcAbsorbResist(), Player::CastItemCombatSpell(), CastSpell(), CalcDamageInfo::cleanDamage, CalcDamageInfo::damage, CalcDamageInfo::damages, CalcDamageInfo::damageSchoolMask, DealDamage(), DealDamageMods(), DIRECT_DAMAGE, EMOTE_ONESHOT_PARRY_SHIELD, EMOTE_ONESHOT_WOUND_CRITICAL, DamageInfo::GetAbsorb(), GetAttackTime(), getAttackTimer(), GetAuraEffectsByType(), DamageInfo::GetDamage(), GetDefenseSkillValue(), Object::GetGUID(), GetHealth(), GetLevel(), SpellInfo::GetSchoolMask(), Object::GetTypeId(), GetUnitMeleeSkill(), HandleEmoteCommand(), Position::HasInArc(), HasUnitState(), haveOffhandWeapon(), CalcDamageInfo::HitInfo, HITINFO_CRITICALHIT, CalcDamageInfo::hitOutCome, SpellInfo::Id, IsAlive(), IsControlledByPlayer(), Creature::IsEvadingAttacks(), IsImmunedToDamageOrSchool(), IsVehicle(), Creature::isWorldBoss(), MAX_ITEM_PROTO_DAMAGES, MELEE_HIT_CRIT, MELEE_HIT_CRUSHING, MELEE_HIT_GLANCING, MELEE_HIT_NORMAL, OFF_ATTACK, CalcDamageInfo::procEx, CalcDamageInfo::procVictim, CalcDamageInfo::resist, roll_chance_f(), WorldObject::SendMessageToSet(), SendSpellDamageImmune(), SendSpellMiss(), setAttackTimer(), SMSG_SPELLDAMAGESHIELD, SPELL_AURA_DAMAGE_SHIELD, SPELL_DIRECT_DAMAGE, SpellDamageBonusTaken(), SpellHitResult(), CalcDamageInfo::target, CalcDamageInfo::TargetState, Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, UNIT_STATE_IN_FLIGHT, VICTIMSTATE_BLOCKS, and VICTIMSTATE_PARRY.

Referenced by AttackerStateUpdate(), and spell_dk_dancing_rune_weapon::HandleProc().

◆ DealSpellDamage()

void Unit::DealSpellDamage ( SpellNonMeleeDamage damageInfo,
bool  durabilityLoss,
Spell const *  spell = nullptr 
)
1436{
1437 if (damageInfo == 0)
1438 return;
1439
1440 Unit* victim = damageInfo->target;
1441
1442 if (!victim)
1443 return;
1444
1445 if (!victim->IsAlive() || victim->IsInFlight() || (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsEvadingAttacks()))
1446 return;
1447
1448 SpellInfo const* spellProto = damageInfo->spellInfo;
1449 if (!spellProto)
1450 {
1451 LOG_DEBUG("entities.unit", "Unit::DealSpellDamage has wrong damageInfo");
1452 return;
1453 }
1454
1455 // Call default DealDamage
1456 CleanDamage cleanDamage(damageInfo->cleanDamage, damageInfo->absorb, BASE_ATTACK, MELEE_HIT_NORMAL);
1457 Unit::DealDamage(this, victim, damageInfo->damage, &cleanDamage, SPELL_DIRECT_DAMAGE, SpellSchoolMask(damageInfo->schoolMask), spellProto, durabilityLoss, false, spell);
1458}
SpellInfo const * spellInfo
Definition: Unit.h:916
bool IsInFlight() const
Definition: Unit.h:1676

References SpellNonMeleeDamage::absorb, BASE_ATTACK, SpellNonMeleeDamage::cleanDamage, SpellNonMeleeDamage::damage, DealDamage(), Object::GetTypeId(), IsAlive(), Creature::IsEvadingAttacks(), IsInFlight(), LOG_DEBUG, MELEE_HIT_NORMAL, SpellNonMeleeDamage::schoolMask, SPELL_DIRECT_DAMAGE, SpellNonMeleeDamage::spellInfo, SpellNonMeleeDamage::target, Object::ToCreature(), and TYPEID_UNIT.

Referenced by Spell::DoAllEffectOnTarget(), spell_sindragosa_s_fury::spell_sindragosa_s_fury_SpellScript::HandleDummy(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), and AuraEffect::HandleProcTriggerDamageAuraProc().

◆ DelayOwnedAuras()

void Unit::DelayOwnedAuras ( uint32  spellId,
ObjectGuid  caster,
int32  delaytime 
)
5381{
5382 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
5383 for (; range.first != range.second; ++range.first)
5384 {
5385 Aura* aura = range.first->second;
5386 if (!caster || aura->GetCasterGUID() == caster)
5387 {
5388 if (aura->GetDuration() < delaytime)
5389 aura->SetDuration(0);
5390 else
5391 aura->SetDuration(aura->GetDuration() - delaytime);
5392
5393 // update for out of range group members (on 1 slot use)
5395 LOG_DEBUG("spells.aura", "Aura {} partially interrupted on unit {}, new duration: {} ms", aura->GetId(), GetGUID().ToString(), aura->GetDuration());
5396 }
5397 }
5398}
std::pair< AuraMap::iterator, AuraMap::iterator > AuraMapBoundsNonConst
Definition: Unit.h:1297
int32 GetDuration() const
Definition: SpellAuras.h:133
void SetNeedClientUpdateForTargets() const
Definition: SpellAuras.cpp:1272
void SetDuration(int32 duration, bool withMods=false)
Definition: SpellAuras.cpp:882

References Aura::GetCasterGUID(), Aura::GetDuration(), Object::GetGUID(), Aura::GetId(), LOG_DEBUG, m_ownedAuras, Aura::SetDuration(), Aura::SetNeedClientUpdateForTargets(), and Position::ToString().

◆ DeleteCharmInfo()

void Unit::DeleteCharmInfo ( )
15708{
15709 if (!m_charmInfo)
15710 return;
15711
15713 delete m_charmInfo;
15714 m_charmInfo = nullptr;
15715}
void RestoreState()
Definition: Unit.cpp:15736

References m_charmInfo, and CharmInfo::RestoreState().

Referenced by RemoveCharmedBy().

◆ DeMorph()

void Unit::DeMorph ( )
4290{
4292}
uint32 GetNativeDisplayId() const
Definition: Unit.h:2170
virtual void SetDisplayId(uint32 modelId)
Definition: Unit.cpp:16910

References GetNativeDisplayId(), and SetDisplayId().

Referenced by modify_commandscript::HandleMorphResetCommand().

◆ DisableRotate()

void Unit::DisableRotate ( bool  apply)
18407{
18408 if (GetTypeId() != TYPEID_UNIT)
18409 return;
18410
18411 if (apply)
18415}
@ UNIT_STATE_POSSESSED
Definition: Unit.h:341
void SetUnitFlag(UnitFlags flags)
Definition: Unit.h:1481

References Object::GetTypeId(), HasUnitState(), RemoveUnitFlag(), SetUnitFlag(), TYPEID_UNIT, UNIT_FLAG_POSSESSED, and UNIT_STATE_POSSESSED.

Referenced by boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::DamageTaken(), boss_thorim::boss_thorimAI::DisableThorim(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::DoAction(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::EnableSara(), boss_anub_arak::boss_anub_arakAI::EnterEvadeMode(), boss_devourer_of_souls::boss_devourer_of_soulsAI::EnterEvadeMode(), boss_garfrost::boss_garfrostAI::EnterEvadeMode(), boss_rotface::boss_rotfaceAI::EnterEvadeMode(), boss_sindragosa::boss_sindragosaAI::EnterEvadeMode(), boss_varos::boss_varosAI::EnterEvadeMode(), boss_ignis::boss_ignisAI::EnterEvadeMode(), boss_razorscale::boss_razorscaleAI::EnterEvadeMode(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::EnterEvadeMode(), boss_razorscale::boss_razorscaleAI::MovementInform(), boss_devourer_of_souls::boss_devourer_of_soulsAI::Reset(), boss_garfrost::boss_garfrostAI::Reset(), boss_sindragosa::boss_sindragosaAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_ignis::boss_ignisAI::Reset(), boss_kologarn::boss_kologarnAI::Reset(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::Reset(), boss_garfrost::boss_garfrostAI::SpellHitTarget(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), and npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::WaypointReached().

◆ DisableSpline()

◆ Dismount()

void Unit::Dismount ( )
13441{
13442 if (!IsMounted())
13443 return;
13444
13447
13448 if (Player* thisPlayer = ToPlayer())
13449 {
13450 WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
13451 data << GetPackGUID();
13452 data << uint32(GameTime::GetGameTime().count()); // Packet counter
13453 data << thisPlayer->GetCollisionHeight();
13454 thisPlayer->GetSession()->SendPacket(&data);
13455 }
13456
13457 WorldPacket data(SMSG_DISMOUNT, 8);
13458 data << GetPackGUID();
13459 SendMessageToSet(&data, true);
13460
13461 // dismount as a vehicle
13463 {
13464 // Send other players that we are no longer a vehicle
13465 data.Initialize(SMSG_PLAYER_VEHICLE_DATA, 8 + 4);
13466 data << GetPackGUID();
13467 data << uint32(0);
13468 ToPlayer()->SendMessageToSet(&data, true);
13469 // Remove vehicle from player
13471 }
13472
13474
13475 // only resummon old pet if the player is already added to a map
13476 // this prevents adding a pet to a not created map which would otherwise cause a crash
13477 // (it could probably happen when logging in after a previous crash)
13478 if (Player* player = ToPlayer())
13479 {
13480 sScriptMgr->AnticheatSetUnderACKmount(player);
13481
13482 if (Pet* pPet = player->GetPet())
13483 {
13484 if (pPet->HasUnitFlag(UNIT_FLAG_STUNNED) && !pPet->HasUnitState(UNIT_STATE_STUNNED))
13485 pPet->RemoveUnitFlag(UNIT_FLAG_STUNNED);
13486 }
13487 else
13488 player->ResummonPetTemporaryUnSummonedIfAny();
13489
13490 // xinef: if we have charmed npc, remove stun also
13491 if (Unit* charm = player->GetCharm())
13492 if (charm->GetTypeId() == TYPEID_UNIT && !charm->HasUnitState(UNIT_STATE_STUNNED))
13493 charm->RemoveUnitFlag(UNIT_FLAG_STUNNED);
13494 }
13495}
@ UNIT_FIELD_MOUNTDISPLAYID
Definition: UpdateFields.h:126
@ UNIT_FLAG_STUNNED
Definition: Unit.h:466
@ UNIT_FLAG_MOUNT
Definition: Unit.h:475
@ AURA_INTERRUPT_FLAG_NOT_MOUNTED
Definition: SpellDefines.h:50
@ SMSG_PLAYER_VEHICLE_DATA
Definition: Opcodes.h:1221
@ SMSG_MOVE_SET_COLLISION_HGT
Definition: Opcodes.h:1332
@ SMSG_DISMOUNT
Definition: Opcodes.h:970
void SendMessageToSet(WorldPacket const *data, bool self) const override
Definition: Player.h:1976
void RemoveVehicleKit()
Definition: Unit.cpp:18865

References AURA_INTERRUPT_FLAG_NOT_MOUNTED, GetCharm(), GameTime::GetGameTime(), Object::GetPackGUID(), Object::GetTypeId(), GetVehicleKit(), WorldPacket::Initialize(), IsMounted(), RemoveAurasWithInterruptFlags(), RemoveUnitFlag(), RemoveVehicleKit(), WorldObject::SendMessageToSet(), Player::SendMessageToSet(), Object::SetUInt32Value(), SMSG_DISMOUNT, SMSG_MOVE_SET_COLLISION_HGT, SMSG_PLAYER_VEHICLE_DATA, sScriptMgr, Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, UNIT_FIELD_MOUNTDISPLAYID, UNIT_FLAG_MOUNT, UNIT_FLAG_STUNNED, and UNIT_STATE_STUNNED.

Referenced by _EnterVehicle(), Player::CleanupAfterTaxiFlight(), FlightPathMovementGenerator::DoFinalize(), npc_scarlet_courier::npc_scarlet_courierAI::EnterCombat(), boss_mandokir::boss_mandokirAI::EnterCombat(), BattlegroundWS::EventPlayerClickedOnFlag(), AuraEffect::HandleAuraMounted(), WorldSession::HandleCancelMountAuraOpcode(), misc_commandscript::HandleDismountCommand(), spell_mount_check::spell_mount_check_AuraScript::HandleEffectPeriodic(), boss_captain_skarloc::boss_captain_skarlocAI::MovementInform(), spell_chapter5_light_of_dawn_aura::spell_chapter5_light_of_dawn_aura_AuraScript::OnApply(), Creature::setDeathState(), SetInCombatState(), npc_troll_volunteer::npc_troll_volunteerAI::SpellHit(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UnMountSelf(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), and npc_koltira_deathweaver::npc_koltira_deathweaverAI::WaypointReached().

◆ EnergizeBySpell()

void Unit::EnergizeBySpell ( Unit victim,
uint32  SpellID,
uint32  Damage,
Powers  powertype 
)
11228{
11229 victim->ModifyPower(powerType, damage, false);
11230
11231 if (powerType != POWER_HAPPINESS)
11232 {
11233 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID);
11234 victim->getHostileRefMgr().threatAssist(this, float(damage) * 0.5f, spellInfo);
11235 }
11236
11237 SendEnergizeSpellLog(victim, spellID, damage, powerType);
11238}
@ POWER_HAPPINESS
Definition: SharedDefines.h:245
void threatAssist(Unit *victim, float baseThreat, SpellInfo const *threatSpell=nullptr)
Definition: HostileRefMgr.cpp:35
void SendEnergizeSpellLog(Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
Definition: Unit.cpp:11216

References getHostileRefMgr(), ModifyPower(), POWER_HAPPINESS, SendEnergizeSpellLog(), sSpellMgr, and HostileRefMgr::threatAssist().

Referenced by Spell::EffectEnergize(), Spell::EffectEnergizePct(), Spell::EffectPowerDrain(), and AuraEffect::HandlePeriodicTriggerSpellAuraTick().

◆ EnterVehicle()

void Unit::EnterVehicle ( Unit base,
int8  seatId = -1 
)
19769{
19771
19772 if (Player* player = ToPlayer())
19773 {
19774 sScriptMgr->AnticheatSetUnderACKmount(player);
19775 sScriptMgr->AnticheatSetSkipOnePacketForASH(player, true);
19776 }
19777}
@ VEHICLE_SPELL_RIDE_HARDCODED
Definition: VehicleDefines.h:53
@ TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE
Will ignore caster aura states including combat requirements and death state.
Definition: SpellDefines.h:144

References CastCustomSpell(), SPELLVALUE_BASE_POINT0, sScriptMgr, Object::ToPlayer(), TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE, and VEHICLE_SPELL_RIDE_HARDCODED.

Referenced by boss_mimiron::boss_mimironAI::EnterCombat(), debug_commandscript::HandleDebugEnterVehicleCommand(), WorldSession::HandleEnterPlayerVehicle(), npc_pilgrims_bounty_chair::UpdateAI(), and boss_mimiron::boss_mimironAI::UpdateAI().

◆ EnterVehicleUnattackable()

void Unit::EnterVehicleUnattackable ( Unit base,
int8  seatId = -1 
)

◆ ExecuteDelayedUnitAINotifyEvent()

void Unit::ExecuteDelayedUnitAINotifyEvent ( )
20724{
20726 if (!this->IsInWorld() || this->IsDuringRemoveFromWorld())
20727 return;
20728
20729 Acore::AIRelocationNotifier notifier(*this);
20730 float radius = 60.0f;
20731 Cell::VisitAllObjects(this, notifier, radius);
20732}
@ NOTIFY_AI_RELOCATION
Definition: Object.h:63
void RemoveFromNotify(uint16 f)
Definition: Object.h:553
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:207
Definition: GridNotifiers.h:89

References IsDuringRemoveFromWorld(), Object::IsInWorld(), NOTIFY_AI_RELOCATION, WorldObject::RemoveFromNotify(), and Cell::VisitAllObjects().

Referenced by Update().

◆ ExecuteDelayedUnitRelocationEvent()

void Unit::ExecuteDelayedUnitRelocationEvent ( )
20617{
20619 if (!this->IsInWorld() || this->IsDuringRemoveFromWorld())
20620 return;
20621
20622 if (this->HasSharedVision())
20623 for (SharedVisionList::const_iterator itr = this->GetSharedVisionList().begin(); itr != this->GetSharedVisionList().end(); ++itr)
20624 if (Player* player = (*itr))
20625 {
20626 if (player->IsOnVehicle(this) || !player->IsInWorld() || player->IsDuringRemoveFromWorld()) // players on vehicles have their own event executed (due to passenger relocation)
20627 continue;
20628 WorldObject* viewPoint = player;
20629 if (player->m_seer && player->m_seer->IsInWorld())
20630 viewPoint = player->m_seer;
20631 if (!viewPoint->IsPositionValid() || !player->IsPositionValid())
20632 continue;
20633
20634 if (Unit* active = viewPoint->ToUnit())
20635 {
20636 //if (active->IsVehicle()) // always check original unit here, last notify position is not relocated
20637 // active = player;
20638
20639 float dx = active->m_last_notify_position.GetPositionX() - active->GetPositionX();
20640 float dy = active->m_last_notify_position.GetPositionY() - active->GetPositionY();
20641 float dz = active->m_last_notify_position.GetPositionZ() - active->GetPositionZ();
20642 float distsq = dx * dx + dy * dy + dz * dz;
20643 float mindistsq = DynamicVisibilityMgr::GetReqMoveDistSq(active->FindMap()->GetEntry()->map_type);
20644 if (distsq < mindistsq)
20645 continue;
20646
20647 // this will be relocated below sharedvision!
20648 //active->m_last_notify_position.Relocate(active->GetPositionX(), active->GetPositionY(), active->GetPositionZ());
20649 }
20650
20651 Acore::PlayerRelocationNotifier relocateNoLarge(*player, false); // visit only objects which are not large; default distance
20652 Cell::VisitAllObjects(viewPoint, relocateNoLarge, player->GetSightRange() + VISIBILITY_INC_FOR_GOBJECTS);
20653 relocateNoLarge.SendToSelf();
20654 Acore::PlayerRelocationNotifier relocateLarge(*player, true); // visit only large objects; maximum distance
20655 Cell::VisitAllObjects(viewPoint, relocateLarge, MAX_VISIBILITY_DISTANCE);
20656 relocateLarge.SendToSelf();
20657 }
20658
20659 if (Player* player = this->ToPlayer())
20660 {
20661 WorldObject* viewPoint = player;
20662 if (player->m_seer && player->m_seer->IsInWorld())
20663 viewPoint = player->m_seer;
20664
20665 if (viewPoint->GetMapId() != player->GetMapId() || !viewPoint->IsPositionValid() || !player->IsPositionValid())
20666 return;
20667
20668 if (Unit* active = viewPoint->ToUnit())
20669 {
20670 if (active->IsVehicle())
20671 active = player;
20672
20673 if (!player->GetFarSightDistance())
20674 {
20675 float dx = active->m_last_notify_position.GetPositionX() - active->GetPositionX();
20676 float dy = active->m_last_notify_position.GetPositionY() - active->GetPositionY();
20677 float dz = active->m_last_notify_position.GetPositionZ() - active->GetPositionZ();
20678 float distsq = dx * dx + dy * dy + dz * dz;
20679
20680 float mindistsq = DynamicVisibilityMgr::GetReqMoveDistSq(active->FindMap()->GetEntry()->map_type);
20681 if (distsq < mindistsq)
20682 return;
20683
20684 active->m_last_notify_position.Relocate(active->GetPositionX(), active->GetPositionY(), active->GetPositionZ());
20685 }
20686 }
20687
20688 Acore::PlayerRelocationNotifier relocateNoLarge(*player, false); // visit only objects which are not large; default distance
20689 Cell::VisitAllObjects(viewPoint, relocateNoLarge, player->GetSightRange() + VISIBILITY_INC_FOR_GOBJECTS);
20690 relocateNoLarge.SendToSelf();
20691
20692 if (!player->GetFarSightDistance())
20693 {
20694 Acore::PlayerRelocationNotifier relocateLarge(*player, true); // visit only large objects; maximum distance
20695 Cell::VisitAllObjects(viewPoint, relocateLarge, MAX_VISIBILITY_DISTANCE);
20696 relocateLarge.SendToSelf();
20697 }
20698
20700 }
20701 else if (Creature* unit = this->ToCreature())
20702 {
20703 if (!unit->IsPositionValid())
20704 return;
20705
20706 float dx = unit->m_last_notify_position.GetPositionX() - unit->GetPositionX();
20707 float dy = unit->m_last_notify_position.GetPositionY() - unit->GetPositionY();
20708 float dz = unit->m_last_notify_position.GetPositionZ() - unit->GetPositionZ();
20709 float distsq = dx * dx + dy * dy + dz * dz;
20710 float mindistsq = DynamicVisibilityMgr::GetReqMoveDistSq(unit->FindMap()->GetEntry()->map_type);
20711 if (distsq < mindistsq)
20712 return;
20713
20714 unit->m_last_notify_position.Relocate(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ());
20715
20716 Acore::CreatureRelocationNotifier relocate(*unit);
20717 Cell::VisitAllObjects(unit, relocate, unit->GetVisibilityRange() + VISIBILITY_COMPENSATION);
20718
20720 }
20721}
@ NOTIFY_VISIBILITY_CHANGED
Definition: Object.h:64
#define MAX_VISIBILITY_DISTANCE
Definition: ObjectDefines.h:31
#define VISIBILITY_INC_FOR_GOBJECTS
Definition: ObjectDefines.h:28
#define VISIBILITY_COMPENSATION
Definition: ObjectDefines.h:26
Unit * ToUnit()
Definition: Object.h:200
void AddToNotify(uint16 f)
Definition: Object.cpp:2907
bool IsPositionValid() const
Definition: Position.cpp:175
uint32 GetMapId() const
Definition: Position.h:276
SharedVisionList const & GetSharedVisionList()
Definition: Unit.h:1889
bool HasSharedVision() const
Definition: Unit.h:1892
Definition: GridNotifiers.h:73
Definition: GridNotifiers.h:81
static float GetReqMoveDistSq(uint32 map_type)
Definition: DynamicVisibility.h:53

References WorldObject::AddToNotify(), WorldLocation::GetMapId(), Position::GetPositionX(), DynamicVisibilityMgr::GetReqMoveDistSq(), GetSharedVisionList(), HasSharedVision(), IsDuringRemoveFromWorld(), Object::IsInWorld(), Position::IsPositionValid(), MAX_VISIBILITY_DISTANCE, NOTIFY_AI_RELOCATION, NOTIFY_VISIBILITY_CHANGED, WorldObject::RemoveFromNotify(), Acore::VisibleNotifier::SendToSelf(), Object::ToCreature(), Object::ToPlayer(), Object::ToUnit(), VISIBILITY_COMPENSATION, VISIBILITY_INC_FOR_GOBJECTS, and Cell::VisitAllObjects().

◆ ExitVehicle()

void Unit::ExitVehicle ( Position const *  exitPosition = nullptr)

This function can be called at upper level code to initialize an exit from the passenger's side.

The following call would not even be executed successfully as the SPELL_AURA_CONTROL_VEHICLE unapply handler already calls _ExitVehicle without specifying an exitposition. The subsequent call below would return on if (!m_vehicle).

To do: We need to allow SPELL_AURA_CONTROL_VEHICLE unapply handlers in spellscripts to specify exit coordinates and either store those per passenger, or we need to init spline movement based on those coordinates in unapply handlers, and relocate exiting passengers based on Unit::moveSpline data. Either way, Coming Soon(TM)

19867{
19869 if (!m_vehicle)
19870 return;
19871
19873 if (Player* player = ToPlayer())
19874 {
19875 player->SetCanTeleport(true);
19876 }
19880 /*_ExitVehicle(exitPosition);*/
19887
19888 if (Player* player = ToPlayer())
19889 {
19890 sScriptMgr->AnticheatSetUnderACKmount(player);
19891 sScriptMgr->AnticheatSetSkipOnePacketForASH(player, true);
19892 }
19893}
Unit * GetVehicleBase() const
Definition: Unit.cpp:18880

References Object::GetGUID(), GetVehicleBase(), m_vehicle, RemoveAurasByType(), SPELL_AURA_CONTROL_VEHICLE, sScriptMgr, and Object::ToPlayer().

Referenced by _EnterVehicle(), Player::ActivateTaxiPathTo(), boss_mimiron::boss_mimironAI::EnterEvadeMode(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::EnterEvadeMode(), npc_ulduar_vx001::npc_ulduar_vx001AI::EnterEvadeMode(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::EnterEvadeMode(), WorldSession::HandleDismissControlledVehicle(), spell_warhead_detonate::spell_warhead_detonate_SpellScript::HandleDummy(), WorldSession::HandleEjectPassenger(), spell_ulduar_squeezed_lifeless::spell_ulduar_squeezed_lifeless_SpellScript::HandleInstaKill(), WorldSession::HandleRequestVehicleExit(), spell_vehicle_throw_passenger::spell_vehicle_throw_passenger_SpellScript::HandleScript(), boss_kologarn_arms::boss_kologarn_armsAI::JustDied(), Player::ProcessDelayedOperations(), RemoveFromWorld(), Player::StopCastingCharm(), and Player::TeleportTo().

◆ FindCurrentSpellBySpellId()

◆ FinishSpell()

void Unit::FinishSpell ( CurrentSpellTypes  spellType,
bool  ok = true 
)
4028{
4029 Spell* spell = m_currentSpells[spellType];
4030 if (!spell)
4031 return;
4032
4033 if (spellType == CURRENT_CHANNELED_SPELL)
4034 spell->SendChannelUpdate(0);
4035
4036 spell->finish(ok);
4037}
void SendChannelUpdate(uint32 time)
Definition: Spell.cpp:5153

References CURRENT_CHANNELED_SPELL, Spell::finish(), m_currentSpells, and Spell::SendChannelUpdate().

Referenced by npc_risen_archmage::npc_risen_archmageAI::EnterCombat(), AuraEffect::HandleFeignDeath(), AuraEffect::HandleModStealth(), boss_lord_marrowgar::UpdateAI(), and GameObject::Use().

◆ GetAffectingPlayer()

Player * Unit::GetAffectingPlayer ( ) const
10586{
10587 if (!GetCharmerOrOwnerGUID())
10588 return const_cast<Unit*>(this)->ToPlayer();
10589
10590 if (Unit* owner = GetCharmerOrOwner())
10592
10593 return nullptr;
10594}
Unit * GetCharmerOrOwner() const
Definition: Unit.h:1847
ObjectGuid GetCharmerOrOwnerGUID() const
Definition: Unit.h:1830

References GetCharmerOrOwner(), GetCharmerOrOwnerGUID(), GetCharmerOrOwnerPlayerOrPlayerItself(), and Object::ToPlayer().

Referenced by _IsValidAssistTarget(), _IsValidAttackTarget(), GetDispellableAuraList(), GetFactionReactionTo(), and GetReactionTo().

◆ GetAI()

UnitAI * Unit::GetAI ( )
inline
1316{ return i_AI; }

References i_AI.

Referenced by spell_algalon_big_bang::spell_algalon_big_bang_SpellScript::CheckTargets(), DealDamage(), DealHeal(), spell_send_mug_target_picker::FilterTargets(), spell_blood_queen_bloodbolt::spell_blood_queen_bloodbolt_SpellScript::FilterTargets(), npc_dream_fog::npc_dream_fogAI::GetRandomUnitFromDragonThreatList(), spell_kaelthas_resurrection::spell_kaelthas_resurrection_SpellScript::HandleBeforeCast(), BattlegroundIC::HandleCapturedNodes(), spell_send_mug_target_picker::HandleDummy(), spell_mount_check::spell_mount_check_AuraScript::HandleEffectPeriodic(), spell_random_aggro::HandleOnHit(), spell_frostwarden_handler_focus_fire::spell_frostwarden_handler_focus_fire_SpellScript::HandleScript(), spell_pursue::spell_pursue_SpellScript::HandleScript(), spell_xt002_gravity_bomb_damage::spell_xt002_gravity_bomb_damage_SpellScript::HandleScript(), spell_the_lich_king_quake::spell_the_lich_king_quake_SpellScript::HandleSendEvent(), npc_risen_guardian::npc_risen_guardianAI::IsSummonedBy(), socrethar::socretharAI::JustDied(), npc_risen_guardian::npc_risen_guardianAI::KilledUnit(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::MovementInform(), npc_pet_mage_mirror_image::MySelectNextTarget(), achievement_respect_your_elders::OnCheck(), achievement_hadronox_denied::OnCheck(), achievement_watch_him_die::OnCheck(), achievement_better_off_dred::OnCheck(), achievement_oh_novos::OnCheck(), achievement_share_the_love::OnCheck(), achievement_snakes_whyd_it_have_to_be_snakes::OnCheck(), achievement_im_on_a_boat::OnCheck(), achievement_all_you_can_eat::OnCheck(), achievement_been_waiting_long_time::OnCheck(), achievement_neck_deep_in_vile::OnCheck(), achievement_portal_jockey::OnCheck(), achievement_chaos_theory::OnCheck(), achievement_split_personality::OnCheck(), achievement_algalon_he_feeds_on_your_tears::OnCheck(), achievement_algalon_herald_of_the_titans::OnCheck(), achievement_flame_leviathan_towers::OnCheck(), achievement_flame_leviathan_shutout::OnCheck(), achievement_freya_getting_back_to_nature::OnCheck(), achievement_freya_knock_on_wood::OnCheck(), achievement_yogg_saron_drive_me_crazy::OnCheck(), achievement_yogg_saron_kiss_and_make_up::OnCheck(), achievement_intense_cold::OnCheck(), achievement_once_bitten_twice_shy::OnCheck(), spell_xt002_gravity_bomb_aura::spell_xt002_gravity_bomb_aura_AuraScript::OnPeriodic(), spell_marrowgar_coldflame::spell_marrowgar_coldflame_SpellScript::SelectTarget(), and boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::SpellHit().

◆ GetAllMinionsByEntry()

void Unit::GetAllMinionsByEntry ( std::list< Creature * > &  Minions,
uint32  entry 
)
10812{
10813 for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();)
10814 {
10815 Unit* unit = *itr;
10816 ++itr;
10817 if (unit->GetEntry() == entry && unit->GetTypeId() == TYPEID_UNIT
10818 && unit->ToCreature()->IsSummon()) // minion, actually
10819 Minions.push_back(unit->ToCreature());
10820 }
10821}
bool IsSummon() const
Definition: Unit.h:1410

References Object::GetEntry(), Object::GetTypeId(), IsSummon(), m_Controlled, Object::ToCreature(), and TYPEID_UNIT.

Referenced by spell_item_gift_of_the_harvester::spell_item_gift_of_the_harvester_SpellScript::CheckRequirement().

◆ GetAPMultiplier()

float Unit::GetAPMultiplier ( WeaponAttackType  attType,
bool  normalized 
)
17364{
17365 if (!normalized || GetTypeId() != TYPEID_PLAYER)
17366 return float(GetAttackTime(attType)) / 1000.0f;
17367
17368 Item* Weapon = ToPlayer()->GetWeaponForAttack(attType, true);
17369 if (!Weapon)
17370 return 2.4f; // fist attack
17371
17372 switch (Weapon->GetTemplate()->InventoryType)
17373 {
17374 case INVTYPE_2HWEAPON:
17375 return 3.3f;
17376 case INVTYPE_RANGED:
17378 case INVTYPE_THROWN:
17379 return 2.8f;
17380 case INVTYPE_WEAPON:
17383 default:
17384 return Weapon->GetTemplate()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER ? 1.7f : 2.4f;
17385 }
17386}
@ ITEM_SUBCLASS_WEAPON_DAGGER
Definition: ItemTemplate.h:368
@ INVTYPE_RANGED
Definition: ItemTemplate.h:280
@ INVTYPE_THROWN
Definition: ItemTemplate.h:290
@ INVTYPE_RANGEDRIGHT
Definition: ItemTemplate.h:291
@ INVTYPE_WEAPON
Definition: ItemTemplate.h:278
@ INVTYPE_WEAPONMAINHAND
Definition: ItemTemplate.h:286
@ INVTYPE_WEAPONOFFHAND
Definition: ItemTemplate.h:287
@ INVTYPE_2HWEAPON
Definition: ItemTemplate.h:282
Weapon
Definition: boss_arlokk.cpp:75
Definition: Item.h:214
Item * GetWeaponForAttack(WeaponAttackType attackType, bool useable=false) const
Definition: PlayerStorage.cpp:519

References GetAttackTime(), Object::GetTypeId(), Player::GetWeaponForAttack(), INVTYPE_2HWEAPON, INVTYPE_RANGED, INVTYPE_RANGEDRIGHT, INVTYPE_THROWN, INVTYPE_WEAPON, INVTYPE_WEAPONMAINHAND, INVTYPE_WEAPONOFFHAND, ITEM_SUBCLASS_WEAPON_DAGGER, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by Creature::CalculateMinMaxDamage(), Player::CalculateMinMaxDamage(), and MeleeDamageBonusDone().

◆ GetAppliedAuras() [1/2]

◆ GetAppliedAuras() [2/2]

AuraApplicationMap const & Unit::GetAppliedAuras ( ) const
inline
1925{ return m_appliedAuras; }

References m_appliedAuras.

◆ GetArmor()

◆ getAttackerForHelper()

Unit * Unit::getAttackerForHelper ( ) const
inline
1367 {
1368 if (GetVictim() != nullptr)
1369 return GetVictim();
1370
1371 if (!IsEngaged())
1372 return nullptr;
1373
1374 if (!m_attackers.empty())
1375 return *(m_attackers.begin());
1376
1377 return nullptr;
1378 }
bool IsEngaged() const
Definition: Unit.h:1685
Unit * GetVictim() const
Definition: Unit.h:1386

References GetVictim(), IsEngaged(), and m_attackers.

Referenced by Creature::_IsTargetAcceptable(), Creature::CanStartAttack(), npc_clintar_spirit::npc_clintar_spiritAI::EnterEvadeMode(), PetAI::SelectNextTarget(), Creature::SelectVictim(), SetControlled(), TotemAI::UpdateAI(), npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI(), and PetAI::UpdateAI().

◆ getAttackers()

◆ GetAttackTime()

◆ getAttackTimer()

◆ GetAura()

Aura * Unit::GetAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0 
) const
5500{
5501 AuraApplication* aurApp = GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask);
5502 return aurApp ? aurApp->GetBase() : nullptr;
5503}
AuraApplication * GetAuraApplication(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
Definition: Unit.cpp:5480

References GetAuraApplication(), and AuraApplication::GetBase().

Referenced by Player::_addSpell(), Pet::addSpell(), spell_mage_burning_determination::CheckProc(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::DamageTaken(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::DoAction(), boss_freya::boss_freyaAI::DoAction(), Spell::DoTriggersOnSpellHit(), Spell::EffectScriptEffect(), Spell::EffectTitanGrip(), Spell::EffectWeaponDmg(), getOrphanGUID(), spell_dk_scourge_strike::HandleAfterHit(), spell_warl_seduction::HandleAuraApply(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraLinked(), Aura::HandleAuraSpecificMods(), deserter_commandscript::HandleDeserterAdd(), deserter_commandscript::HandleDeserterRemove(), deserter_commandscript::HandleDeserterRemoveAll(), spell_ahn_kahet_swarmer_aura::HandleDummy(), spell_item_pygmy_oil::HandleDummy(), HandleDummyAuraProc(), spell_yogg_saron_sanity_well::spell_yogg_saron_sanity_well_AuraScript::HandleEffectPeriodic(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), spell_sindragosa_frost_breath::spell_sindragosa_frost_breath_SpellScript::HandleInfusion(), spell_dk_blood_caked_blade::HandleProc(), HandleProcTriggerSpell(), AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(), spell_putricide_unstable_experiment::spell_putricide_unstable_experiment_SpellScript::HandleScript(), spell_festergut_gastric_bloat::spell_festergut_gastric_bloat_SpellScript::HandleScript(), spell_putricide_eat_ooze::spell_putricide_eat_ooze_SpellScript::HandleScript(), spell_rotface_large_ooze_combine::spell_rotface_large_ooze_combine_SpellScript::HandleScript(), spell_yogg_saron_sanity_reduce::spell_yogg_saron_sanity_reduce_SpellScript::HandleScriptEffect(), spell_dk_pestilence::HandleScriptEffect(), spell_pri_lightwell::HandleScriptEffect(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::InitializeAI(), npc_spiritual_insight::npc_spiritual_insightAI::IsSummonedBy(), npc_gunship::npc_gunshipAI::JustDied(), npc_brew_bubble::MoveInLineOfSight(), npc_brewfest_keg_reciver::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), spell_hodir_flash_freeze::spell_hodir_flash_freeze_AuraScript::PrepareAuraScript(), spell_charge_shield_bomber::spell_charge_shield_bomber_SpellScript::PrepareSpellScript(), Player::ProcessDelayedOperations(), BattlefieldWG::PromotePlayer(), RemoveAurasDueToSpellBySteal(), Player::ResurrectPlayer(), SetAuraStack(), boss_anomalus::boss_anomalusAI::SetData(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::SpellHit(), npc_pilgrims_bounty_chair::SpellHit(), boss_jaraxxus::boss_jaraxxusAI::SpellHit(), npc_wild_wyrm::npc_wild_wyrmAI::SpellHit(), boss_sindragosa::boss_sindragosaAI::SpellHitTarget(), npc_ulduar_hodir_shaman::npc_ulduar_hodir_shamanAI::SpellHitTarget(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::SpellHitTarget(), npc_twilight_summon::npc_twilight_summonAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_freya::boss_freyaAI::UpdateAI(), boss_freya_elder_brightleaf::boss_freya_elder_brightleafAI::UpdateAI(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::UpdateAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::UpdateAI(), and Player::UpdateTitansGrip().

◆ GetAuraApplication()

AuraApplication * Unit::GetAuraApplication ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraApplication except = nullptr 
) const
5481{
5482 AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
5483 for (; range.first != range.second; ++range.first)
5484 {
5485 AuraApplication* app = range.first->second;
5486 Aura const* aura = app->GetBase();
5487
5488 if (((aura->GetEffectMask() & reqEffMask) == reqEffMask)
5489 && (!casterGUID || aura->GetCasterGUID() == casterGUID)
5490 && (!itemCasterGUID || aura->GetCastItemGUID() == itemCasterGUID)
5491 && (!except || except != app))
5492 {
5493 return app;
5494 }
5495 }
5496 return nullptr;
5497}
std::pair< AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator > AuraApplicationMapBounds
Definition: Unit.h:1300
uint8 GetEffectMask() const
Definition: SpellAuras.h:176
ObjectGuid GetCastItemGUID() const
Definition: SpellAuras.h:103

References AuraApplication::GetBase(), Aura::GetCasterGUID(), Aura::GetCastItemGUID(), Aura::GetEffectMask(), and m_appliedAuras.

Referenced by AuraApplication::_Remove(), GetAura(), GetAuraApplicationOfRankedSpell(), HasAura(), and Spell::UpdateChanneledTargetList().

◆ GetAuraApplicationOfRankedSpell()

AuraApplication * Unit::GetAuraApplicationOfRankedSpell ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraApplication except = nullptr 
) const
5506{
5507 uint32 rankSpell = sSpellMgr->GetFirstSpellInChain(spellId);
5508 while (rankSpell)
5509 {
5510 if (AuraApplication* aurApp = GetAuraApplication(rankSpell, casterGUID, itemCasterGUID, reqEffMask, except))
5511 return aurApp;
5512 rankSpell = sSpellMgr->GetNextSpellInChain(rankSpell);
5513 }
5514 return nullptr;
5515}

References GetAuraApplication(), and sSpellMgr.

Referenced by spell_warl_drain_soul::CheckProc(), and GetAuraOfRankedSpell().

◆ GetAuraCount()

◆ GetAuraEffect() [1/3]

AuraEffect * Unit::GetAuraEffect ( AuraType  type,
SpellFamilyNames  family,
uint32  familyFlag1,
uint32  familyFlag2,
uint32  familyFlag3,
ObjectGuid  casterGUID = ObjectGuid::Empty 
) const
5453{
5454 AuraEffectList const& auras = GetAuraEffectsByType(type);
5455 for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
5456 {
5457 SpellInfo const* spell = (*i)->GetSpellInfo();
5458 if (spell->SpellFamilyName == uint32(family) && spell->SpellFamilyFlags.HasFlag(familyFlag1, familyFlag2, familyFlag3))
5459 {
5460 if (casterGUID && (*i)->GetCasterGUID() != casterGUID)
5461 continue;
5462 return (*i);
5463 }
5464 }
5465 return nullptr;
5466}
bool HasFlag(uint32 p1=0, uint32 p2=0, uint32 p3=0) const
Definition: Util.h:463
flag96 SpellFamilyFlags
Definition: SpellInfo.h:386
uint32 SpellFamilyName
Definition: SpellInfo.h:385

References GetAuraEffectsByType(), flag96::HasFlag(), SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

◆ GetAuraEffect() [2/3]

AuraEffect * Unit::GetAuraEffect ( AuraType  type,
SpellFamilyNames  name,
uint32  iconId,
uint8  effIndex 
) const
5439{
5440 AuraEffectList const& auras = GetAuraEffectsByType(type);
5441 for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
5442 {
5443 if (effIndex != (*itr)->GetEffIndex())
5444 continue;
5445 SpellInfo const* spell = (*itr)->GetSpellInfo();
5446 if (spell->SpellIconID == iconId && spell->SpellFamilyName == name)
5447 return *itr;
5448 }
5449 return nullptr;
5450}
uint32 SpellIconID
Definition: SpellInfo.h:378

References GetAuraEffectsByType(), SpellInfo::SpellFamilyName, and SpellInfo::SpellIconID.

◆ GetAuraEffect() [3/3]

AuraEffect * Unit::GetAuraEffect ( uint32  spellId,
uint8  effIndex,
ObjectGuid  casterGUID = ObjectGuid::Empty 
) const
5413{
5414 AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
5415 for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
5416 {
5417 if (itr->second->HasEffect(effIndex)
5418 && (!caster || itr->second->GetBase()->GetCasterGUID() == caster))
5419 {
5420 return itr->second->GetBase()->GetEffect(effIndex);
5421 }
5422 }
5423 return nullptr;
5424}

References m_appliedAuras.

Referenced by CalculateSpellAmount(), Spell::CanAutoCast(), spell_mage_ice_barrier::CheckCast(), spell_pri_power_word_shield::CheckCast(), spell_mage_molten_armor::CheckProc(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), Spell::EffectScriptEffect(), Spell::EffectWeaponDmg(), ConflagrateAuraStateDelayEvent::Execute(), spell_dru_t10_restoration_4p_bonus::FilterTargets(), GetAuraEffectOfRankedSpell(), GetDummyAuraEffect(), AuraEffect::HandleAuraModShapeshift(), Aura::HandleAuraSpecificMods(), spell_dk_raise_ally::HandleDummy(), spell_dk_death_coil::HandleDummy(), spell_dk_death_strike::HandleDummy(), spell_dk_scourge_strike::HandleDummy(), spell_warl_life_tap::HandleDummy(), HandleDummyAuraProc(), spell_warr_execute::HandleEffect(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_item_blessing_of_ancient_kings::HandleProc(), spell_pal_sacred_shield_base::HandleProc(), spell_pri_divine_aegis::HandleProc(), HandleProcTriggerSpell(), AuraEffect::HandleShapeshiftBoosts(), spell_warl_drain_soul::HandleTick(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::InitializeAI(), Guardian::InitStatsForLevel(), MeleeDamageBonusDone(), ModSpellDuration(), spell_dk_death_and_decay::RecalculateDamage(), RemoveAurasDueToSpellByDispel(), SpellDamageBonusDone(), SpellHealingBonusTaken(), npc_soh_fire_trigger::SpellHit(), npc_hallows_end_train_fire::SpellHit(), SpellPctDamageModsDone(), SpellPctHealingModsDone(), SpellTakenCritChance(), spell_mage_incanters_absorbtion_base_AuraScript::Trigger(), and npc_hallows_end_train_fire::UpdateAI().

◆ GetAuraEffectDummy()

AuraEffect * Unit::GetAuraEffectDummy ( uint32  spellid) const
5469{
5471 for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
5472 {
5473 if ((*itr)->GetId() == spellid)
5474 return *itr;
5475 }
5476
5477 return nullptr;
5478}
@ SPELL_AURA_DUMMY
Definition: SpellAuraDefines.h:67

References GetAuraEffectsByType(), and SPELL_AURA_DUMMY.

Referenced by Spell::EffectWeaponDmg(), Aura::HandleAuraSpecificMods(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), spell_dk_scourge_strike::HandleDummy(), Guardian::InitStatsForLevel(), Kill(), spell_dk_death_and_decay::RecalculateDamage(), Player::RemoveSpellMods(), and SpellHealingBonusTaken().

◆ GetAuraEffectOfRankedSpell()

AuraEffect * Unit::GetAuraEffectOfRankedSpell ( uint32  spellId,
uint8  effIndex,
ObjectGuid  casterGUID = ObjectGuid::Empty 
) const
5427{
5428 uint32 rankSpell = sSpellMgr->GetFirstSpellInChain(spellId);
5429 while (rankSpell)
5430 {
5431 if (AuraEffect* aurEff = GetAuraEffect(rankSpell, effIndex, caster))
5432 return aurEff;
5433 rankSpell = sSpellMgr->GetNextSpellInChain(rankSpell);
5434 }
5435 return nullptr;
5436}
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:5412

References GetAuraEffect(), and sSpellMgr.

Referenced by spell_mage_fire_frost_ward::Absorb(), spell_sha_earthbind_totem::Apply(), spell_sha_earthliving_weapon::CheckProc(), spell_dru_enrage::HandleApply(), spell_pal_avenging_wrath::HandleApply(), spell_dk_presence::HandleImprovedBloodPresence(), spell_dk_presence::HandleImprovedFrostPresence(), spell_dk_presence::HandleImprovedUnholyPresence(), SpellPctDamageModsDone(), and spell_mage_incanters_absorbtion_base_AuraScript::Trigger().

◆ GetAuraEffectsByType()

AuraEffectList const & Unit::GetAuraEffectsByType ( AuraType  type) const
inline
1967{ return m_modAuras[type]; }

References m_modAuras.

Referenced by Player::_ApplyWeaponDependentAuraMods(), Spell::_cast(), AuraApplication::_HandleEffect(), KillRewarder::_RewardXP(), CalcAbsorbResist(), CalcArmorReducedDamage(), CalcHealAbsorb(), AuraEffect::CalculateAmount(), Spell::CheckCast(), Spell::CheckCasterAuras(), DealDamage(), DealMeleeDamage(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), spell_dk_wandering_plague::FilterTargets(), GetAuraEffect(), GetAuraEffectDummy(), GetDoTsByCaster(), GetMagicHitRedirectTarget(), GetMaxNegativeAuraModifier(), GetMaxNegativeAuraModifierByAffectMask(), GetMaxNegativeAuraModifierByMiscMask(), GetMaxNegativeAuraModifierByMiscValue(), GetMaxPositiveAuraModifier(), GetMaxPositiveAuraModifierByAffectMask(), GetMaxPositiveAuraModifierByMiscMask(), GetMaxPositiveAuraModifierByMiscValue(), Player::getMaxTimer(), GetMeleeHitRedirectTarget(), GetPhaseByAuras(), Player::GetResurrectionSpellId(), Player::GetRuneBaseCooldown(), GetTotalAuraModifier(), GetTotalAuraModifierAreaExclusive(), GetTotalAuraModifierByAffectMask(), GetTotalAuraModifierByMiscMask(), GetTotalAuraModifierByMiscValue(), GetTotalAuraMultiplier(), GetTotalAuraMultiplierByAffectMask(), GetTotalAuraMultiplierByMiscMask(), GetTotalAuraMultiplierByMiscValue(), GetUnitCriticalChance(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModDisarm(), AuraEffect::HandleAuraModSchoolImmunity(), Aura::HandleAuraSpecificMods(), AuraEffect::HandleAuraTransform(), AuraEffect::HandleDetectAmore(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), HandleDummyAuraProc(), Spell::HandleLaunchPhase(), WorldSession::HandleMessagechatOpcode(), WorldSession::HandleMirrorImageDataRequest(), AuraEffect::HandleModInvisibility(), AuraEffect::HandleNoReagentUseAura(), spell_illidari_council_judgement::spell_illidari_council_judgement_SpellScript::HandleScriptEffect(), spell_pal_judgement::HandleScriptEffect(), AuraEffect::HandleShapeshiftBoosts(), HasAuraState(), HasAuraTypeWithAffectMask(), HasAuraTypeWithCaster(), HasAuraTypeWithFamilyFlags(), HasAuraTypeWithMiscvalue(), HasAuraTypeWithTriggerSpell(), HasAuraTypeWithValue(), HasBreakableByDamageAuraType(), HasVisibleAuraType(), IsImmunedToSpellEffect(), IsScriptOverriden(), SpellInfo::IsStrongerAuraActive(), Player::isTotalImmune(), list_commandscript::ListAurasCommand(), MeleeDamageBonusDone(), MeleeDamageBonusTaken(), MeleeSpellHitResult(), Spell::PrepareTriggersExecutedOnHit(), processDummyAuras(), spell_dru_enrage::RecalculateBaseArmor(), Creature::Regenerate(), Player::Regenerate(), Player::RegenerateAll(), Creature::RegenerateHealth(), Player::RegenerateHealth(), Creature::Respawn(), RestoreDisplayId(), Player::RewardQuest(), Spell::SelectImplicitAreaTargets(), Spell::SelectImplicitConeTargets(), PetAI::SelectNextTarget(), Creature::SelectVictim(), Player::SendInitialPacketsAfterAddToMap(), SetControlled(), Player::SetEntryPoint(), Player::SetSkill(), SpellBaseDamageBonusDone(), SpellBaseDamageBonusTaken(), SpellBaseHealingBonusDone(), SpellBaseHealingBonusTaken(), SpellDamageBonusDone(), SpellDamageBonusTaken(), SpellHealingBonusDone(), SpellHealingBonusTaken(), SpellHitResult(), SpellPctDamageModsDone(), SpellPctHealingModsDone(), SpellTakenCritChance(), Player::SummonPet(), Player::TeleportTo(), SimpleCharmedAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), Player::UpdateArmor(), Player::UpdateAttackPowerAndDamage(), Player::UpdateCharmedAI(), Player::UpdateExpertise(), Player::UpdateManaRegen(), Player::UpdateRating(), Player::UpdateResistances(), UpdateSpeed(), and Player::UpdateStats().

◆ GetAuraOfRankedSpell()

Aura * Unit::GetAuraOfRankedSpell ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0 
) const
5518{
5519 AuraApplication* aurApp = GetAuraApplicationOfRankedSpell(spellId, casterGUID, itemCasterGUID, reqEffMask);
5520 return aurApp ? aurApp->GetBase() : nullptr;
5521}
AuraApplication * GetAuraApplicationOfRankedSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
Definition: Unit.cpp:5505

References GetAuraApplicationOfRankedSpell(), and AuraApplication::GetBase().

Referenced by Aura::HandleAuraSpecificMods().

◆ GetCastingTimeForBonus()

uint32 Unit::GetCastingTimeForBonus ( SpellInfo const *  spellProto,
DamageEffectType  damagetype,
uint32  CastingTime 
) const
17224{
17225 // Not apply this to creature casted spells with casttime == 0
17226 if (CastingTime == 0 && GetTypeId() == TYPEID_UNIT && !IsPet())
17227 return 3500;
17228
17229 if (CastingTime > 7000) CastingTime = 7000;
17230 if (CastingTime < 1500) CastingTime = 1500;
17231
17232 if (damagetype == DOT && !spellProto->IsChanneled())
17233 CastingTime = 3500;
17234
17235 int32 overTime = 0;
17236 uint8 effects = 0;
17237 bool DirectDamage = false;
17238 bool AreaEffect = false;
17239
17240 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; i++)
17241 {
17242 switch (spellProto->Effects[i].Effect)
17243 {
17249 case SPELL_EFFECT_HEAL:
17250 DirectDamage = true;
17251 break;
17253 switch (spellProto->Effects[i].ApplyAuraName)
17254 {
17258 if (spellProto->GetDuration())
17259 overTime = spellProto->GetDuration();
17260 break;
17261 default:
17262 // -5% per additional effect
17263 ++effects;
17264 break;
17265 }
17266 default:
17267 break;
17268 }
17269
17270 if (spellProto->Effects[i].IsTargetingArea())
17271 AreaEffect = true;
17272 }
17273
17274 // Combined Spells with Both Over Time and Direct Damage
17275 if (overTime > 0 && DirectDamage)
17276 {
17277 // mainly for DoTs which are 3500 here otherwise
17278 uint32 OriginalCastTime = spellProto->CalcCastTime();
17279 if (OriginalCastTime > 7000) OriginalCastTime = 7000;
17280 if (OriginalCastTime < 1500) OriginalCastTime = 1500;
17281 // Portion to Over Time
17282 float PtOT = (overTime / 15000.0f) / ((overTime / 15000.0f) + (OriginalCastTime / 3500.0f));
17283
17284 if (damagetype == DOT)
17285 CastingTime = uint32(CastingTime * PtOT);
17286 else if (PtOT < 1.0f)
17287 CastingTime = uint32(CastingTime * (1 - PtOT));
17288 else
17289 CastingTime = 0;
17290 }
17291
17292 // Area Effect Spells receive only half of bonus
17293 if (AreaEffect)
17294 CastingTime /= 2;
17295
17296 // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing
17297 for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
17298 {
17299 if (spellProto->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH ||
17300 (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH))
17301 {
17302 CastingTime /= 2;
17303 break;
17304 }
17305 }
17306
17307 // -5% of total per any additional effect
17308 for (uint8 i = 0; i < effects; ++i)
17309 CastingTime *= 0.95f;
17310
17311 return CastingTime;
17312}
@ SPELL_AURA_PERIODIC_DAMAGE
Definition: SpellAuraDefines.h:66
@ SPELL_AURA_PERIODIC_HEAL
Definition: SpellAuraDefines.h:71
@ SPELL_AURA_PERIODIC_LEECH
Definition: SpellAuraDefines.h:116
@ SPELL_EFFECT_POWER_BURN
Definition: SharedDefines.h:812
@ SPELL_EFFECT_HEALTH_LEECH
Definition: SharedDefines.h:759
@ SPELL_EFFECT_HEAL
Definition: SharedDefines.h:760
@ SPELL_EFFECT_ENVIRONMENTAL_DAMAGE
Definition: SharedDefines.h:757
@ SPELL_EFFECT_POWER_DRAIN
Definition: SharedDefines.h:758
@ SPELL_EFFECT_SCHOOL_DAMAGE
Definition: SharedDefines.h:752
@ SPELL_EFFECT_APPLY_AURA
Definition: SharedDefines.h:756

References SpellInfo::CalcCastTime(), DOT, SpellInfo::Effects, SpellInfo::GetDuration(), Object::GetTypeId(), SpellInfo::IsChanneled(), IsPet(), MAX_SPELL_EFFECTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_LEECH, SPELL_EFFECT_APPLY_AURA, SPELL_EFFECT_ENVIRONMENTAL_DAMAGE, SPELL_EFFECT_HEAL, SPELL_EFFECT_HEALTH_LEECH, SPELL_EFFECT_POWER_BURN, SPELL_EFFECT_POWER_DRAIN, SPELL_EFFECT_SCHOOL_DAMAGE, and TYPEID_UNIT.

Referenced by CalculateDefaultCoefficient().

◆ GetCharm()

Unit * Unit::GetCharm ( ) const
10627{
10628 if (ObjectGuid charm_guid = GetCharmGUID())
10629 {
10630 if (Unit* pet = ObjectAccessor::GetUnit(*this, charm_guid))
10631 return pet;
10632
10633 LOG_ERROR("entities.unit", "Unit::GetCharm: Charmed creature {} not exist.", charm_guid.ToString());
10635 }
10636
10637 return nullptr;
10638}
@ UNIT_FIELD_CHARM
Definition: UpdateFields.h:86
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:204
void SetGuidValue(uint16 index, ObjectGuid value)
Definition: Object.cpp:723
ObjectGuid GetCharmGUID() const
Definition: Unit.h:1822

References ObjectGuid::Empty, GetCharmGUID(), ObjectAccessor::GetUnit(), LOG_ERROR, Object::SetGuidValue(), and UNIT_FIELD_CHARM.

Referenced by Spell::_cast(), AddPetAura(), spell_hun_check_pet_los::CheckCast(), Spell::CheckCast(), Dismount(), Spell::finish(), GetFirstControlled(), spell_warl_eye_of_kilrogg::HandleAuraApply(), spell_warl_eye_of_kilrogg::HandleAuraRemove(), spell_dk_raise_ally::HandleDummy(), WorldSession::HandlePetCastSpellOpcode(), WorldSession::HandlePetSpellAutocastOpcode(), WorldSession::HandleRequestPetInfo(), isPossessing(), Mount(), Player::PossessSpellInitialize(), RemovePetAura(), Spell::SelectImplicitCasterObjectTargets(), SetSpeed(), npc_pilgrims_bounty_chair::SpellHitTarget(), and Player::StopCastingCharm().

◆ GetCharmer()

◆ GetCharmerGUID()

◆ GetCharmerOrOwner()

◆ GetCharmerOrOwnerGUID()

◆ GetCharmerOrOwnerOrOwnGUID()

◆ GetCharmerOrOwnerOrSelf()

Unit * Unit::GetCharmerOrOwnerOrSelf ( ) const
inline
1849 {
1850 if (Unit* u = GetCharmerOrOwner())
1851 return u;
1852
1853 return (Unit*)this;
1854 }

References GetCharmerOrOwner().

Referenced by CombatStart(), CombatStartOnCast(), GetPartyMembers(), GetReactionTo(), IsInPartyWith(), IsInRaidWith(), SetInCombatWith(), and TotemAI::UpdateAI().

◆ GetCharmerOrOwnerPlayerOrPlayerItself()

Player * Unit::GetCharmerOrOwnerPlayerOrPlayerItself ( ) const
10577{
10579 if (guid.IsPlayer())
10580 return ObjectAccessor::GetPlayer(*this, guid);
10581
10582 return const_cast<Unit*>(this)->ToPlayer();
10583}
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:225

References GetCharmerOrOwnerGUID(), ObjectAccessor::GetPlayer(), ObjectGuid::IsPlayer(), and Object::ToPlayer().

Referenced by Spell::_handle_finish_phase(), spell_sha_earthbind_totem::Apply(), npc_escortAI::AssistPlayerInCombatAgainst(), FollowerAI::AssistPlayerInCombatAgainst(), BuildValuesUpdate(), spell_q12237_rescue_villager::CheckCast(), spell_q12237_drop_off_villager::CheckCast(), CombatStart(), CombatStartOnCast(), npc_salsalabim::npc_salsalabimAI::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), DealDamage(), Spell::EffectGameObjectSetDestructionState(), Spell::EffectKillCredit(), Spell::EffectKillCreditPersonal(), Spell::EffectSummonPet(), GetAffectingPlayer(), Object::GetUpdateFieldData(), spell_gen_charmed_unit_spell_cooldown::HandleCast(), spell_q13007_iron_colossus::spell_q13007_iron_colossus_SpellScript::HandleDummy(), spell_pilgrims_bounty_pass_generic::HandleDummy(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), spell_q12851_going_bearback::HandleEffectApply(), spell_q12726_song_of_wind_and_water::spell_q12726_song_of_wind_and_water_SpellScript::HandleHealPct(), spell_winter_veil_racer_slam_hit::HandleScriptEffect(), spell_q10612_10613_the_fel_and_the_furious::spell_q10612_10613_the_fel_and_the_furious_SpellScript::HandleScriptEffect(), spell_q10769_dissension_amongst_the_ranks::HandleScriptEffect(), npc_pet_gen_valkyr_guardian::InitializeAI(), isTargetableForAttack(), GuardAI::JustDied(), boss_kurinnaxx::JustDied(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustDied(), npc_darnavan::npc_darnavanAI::JustDied(), npc_four_car_garage::npc_four_car_garageAI::JustDied(), npc_scion_of_eternity::npc_scion_of_eternityAI::JustDied(), Kill(), Condition::Meets(), GameObject::ModifyHealth(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::MoveInLineOfSight(), npc_fel_guard_hound::npc_fel_guard_houndAI::MovementInform(), SmartScript::ProcessAction(), ProcessTerrainStatusUpdate(), Pet::RemoveSpellCooldown(), Spell::SendSpellCooldown(), SetCharm(), SetContestedPvP(), SetInCombatState(), Creature::SetLootRecipient(), npc_deaths_door_fell_cannon_target_bunny::npc_deaths_door_fell_cannon_target_bunnyAI::SpellHit(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_pet_shaman_earth_elemental::UpdateAI(), npc_pet_shaman_fire_elemental::UpdateAI(), and Creature::UpdateEntry().

◆ GetCharmGUID()

◆ GetCharmInfo()

◆ getClass()

uint8 Unit::getClass ( ) const
inline
1426{ return GetByteValue(UNIT_FIELD_BYTES_0, 1); }
@ UNIT_FIELD_BYTES_0
Definition: UpdateFields.h:95
uint8 GetByteValue(uint16 index, uint8 offset) const
Definition: Object.cpp:323

References Object::GetByteValue(), and UNIT_FIELD_BYTES_0.

Referenced by Player::_ApplyItemBonuses(), Player::_LoadHomeBind(), Player::_LoadSkills(), Player::_SaveCharacter(), Player::ActivateSpec(), Player::ActivateTaxiPathTo(), ArenaTeam::AddMember(), Player::AddSpellMod(), Player::ApplyEnchantment(), Player::CalculateTalentsPoints(), Group::CanJoinBattlegroundQueue(), Player::CanResummonPet(), Player::CanRollForItemInLFG(), Player::CanUseItem(), Spell::CheckCast(), Spell::CheckRuneCost(), ClearAllReactives(), Player::Create(), WorldSession::DoLootRelease(), Player::DuelComplete(), Spell::EffectActivateRune(), Spell::EffectCreateTamedPet(), Spell::EffectSummonPet(), Spell::EffectTameCreature(), Player::EquipItem(), spell_class_call_handler::FilterTargets(), Player::FindEquipSlot(), boss_archimonde::boss_archimondeAI::GainSoulCharge(), getClassMask(), Graveyard::GetClosestGraveyard(), GetDebugInfo(), Player::GetDodgeFromAgility(), SocialMgr::GetFriendInfo(), Player::GetMeleeCritFromAgility(), Player::GetMissPercentageFromDefence(), Player::GetNPCIfCanInteractWith(), spell_gen_on_tournament_mount::GetPennatSpellId(), Player::GetPlayerName(), Player::GetRatingMultiplier(), Player::GetSpec(), Player::GetSpellCritFromIntellect(), Player::GetStartPosition(), Player::GiveLevel(), AuraEffect::HandleAuraConvertRune(), AuraEffect::HandleAuraModShapeshift(), Aura::HandleAuraSpecificMods(), WorldSession::HandleAutostoreLootItemOpcode(), WorldSession::HandleBattlemasterJoinOpcode(), spell_item_flask_of_the_north::HandleDummy(), spell_item_refocus::HandleDummy(), HandleDummyAuraProc(), learn_commandscript::HandleLearnAllMySpellsCommand(), WorldSession::HandleLootMoneyOpcode(), WorldSession::HandleMirrorImageDataRequest(), modify_commandscript::HandleModifyGenderCommand(), AuraEffect::HandlePeriodicDummyAuraTick(), misc_commandscript::HandlePInfoCommand(), WorldSession::HandlePlayerLoginFromDB(), HandleProcTriggerSpell(), ArenaSpectator::HandleResetCommand(), reset_commandscript::HandleResetLevelCommand(), reset_commandscript::HandleResetStatsOrLevelHelper(), spell_gen_pet_summoned::HandleScript(), ArenaSpectator::HandleSpectatorSpectateCommand(), Player::InitDataForForm(), Player::InitDisplayIds(), Player::InitRunes(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), Player::InitTaxiNodesForLevel(), Vehicle::Install(), Creature::isCanTrainingAndResetTalentsOf(), Pet::IsPermanentPetFor(), Creature::IsValidTrainerForPlayer(), Kill(), Player::LearnCustomSpells(), Player::LearnDefaultSkill(), Player::LearnDefaultSkills(), spell_dk_blood_boil::Load(), Player::LoadFromDB(), Pet::LoadPetFromDB(), AchievementCriteriaData::Meets(), Player::OCTRegenHPPerSpirit(), Player::OCTRegenMPPerSpirit(), npc_bunthen_plainswind::OnGossipHello(), npc_silva_filnaveth::OnGossipHello(), npc_bunthen_plainswind::OnGossipSelect(), npc_silva_filnaveth::OnGossipSelect(), ClassCallSelector::operator()(), Acore::WorldObjectSpellTargetCheck::operator()(), Player::PrepareGossipMenu(), ProcDamageAndSpellFor(), Player::RegenerateAll(), RemoveCharmedBy(), Player::RewardHonor(), Spell::SendSpellGo(), SetCharmedBy(), Guild::Member::SetStats(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::SpellHitTarget(), Player::StoreNewItemInBestSlots(), Spell::TakeRunePower(), Player::TeleportTo(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::UpdateAI(), Player::UpdateAttackPowerAndDamage(), Player::UpdateDodgePercentage(), Player::UpdateParryPercentage(), lfg::LFGMgr::UpdateRaidBrowser(), UpdateReactives(), and Player::UpdateSkillsForLevel().

◆ getClassMask()

◆ GetCollisionHeight()

float Unit::GetCollisionHeight ( ) const
overridevirtual

Return collision height sent to client.

Reimplemented from WorldObject.

21232{
21233 float scaleMod = GetObjectScale(); // 99% sure about this
21234 float defaultHeight = DEFAULT_COLLISION_HEIGHT * scaleMod;
21235
21236 CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.AssertEntry(GetNativeDisplayId());
21237 CreatureModelDataEntry const* modelData = sCreatureModelDataStore.AssertEntry(displayInfo->ModelId);
21238 float collisionHeight = 0.0f;
21239
21240 if (IsMounted())
21241 {
21243 {
21244 if (CreatureModelDataEntry const* mountModelData = sCreatureModelDataStore.LookupEntry(mountDisplayInfo->ModelId))
21245 {
21246 collisionHeight = scaleMod * (mountModelData->MountHeight + modelData->CollisionHeight * modelData->Scale * displayInfo->scale * 0.5f);
21247 }
21248 }
21249 }
21250 else
21251 collisionHeight = scaleMod * modelData->CollisionHeight * modelData->Scale * displayInfo->scale;
21252
21253 return collisionHeight == 0.0f ? defaultHeight : collisionHeight;
21254}
DBCStorage< CreatureDisplayInfoEntry > sCreatureDisplayInfoStore(CreatureDisplayInfofmt)
DBCStorage< CreatureModelDataEntry > sCreatureModelDataStore(CreatureModelDatafmt)
#define DEFAULT_COLLISION_HEIGHT
Definition: ObjectDefines.h:50
float GetObjectScale() const
Definition: Object.h:112
Definition: DBCStructure.h:721
uint32 ModelId
Definition: DBCStructure.h:723
float scale
Definition: DBCStructure.h:726
Definition: DBCStructure.h:775
float Scale
Definition: DBCStructure.h:780
float CollisionHeight
Definition: DBCStructure.h:791

References CreatureModelDataEntry::CollisionHeight, DEFAULT_COLLISION_HEIGHT, GetNativeDisplayId(), Object::GetObjectScale(), Object::GetUInt32Value(), IsMounted(), CreatureDisplayInfoEntry::ModelId, CreatureDisplayInfoEntry::scale, CreatureModelDataEntry::Scale, sCreatureDisplayInfoStore, sCreatureModelDataStore, and UNIT_FIELD_MOUNTDISPLAYID.

Referenced by DynObjAura::FillTargetMap(), WorldObject::GetNearPoint(), GetRandomContactPoint(), WorldSession::HandleMovementOpcodes(), Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator()(), Spell::SelectImplicitCasterDestTargets(), WorldObject::UpdateAllowedPositionZ(), and Creature::UpdateMovementFlags().

◆ GetCollisionRadius()

float Unit::GetCollisionRadius ( ) const
overridevirtual

this method gets the radius of a Unit by DB if any value is defined, otherwise it gets the value by the DBC

If the player is mounted the radius also takes in consideration the mount size

Returns
float The radius of a unit

Reimplemented from WorldObject.

21226{
21227 return GetCollisionWidth() / 2;
21228}
float GetCollisionWidth() const override
this method gets the diameter of a Unit by DB if any value is defined, otherwise it gets the value by...
Definition: Unit.cpp:21188

References GetCollisionWidth().

Referenced by GetMeleeAttackPoint(), and Creature::Update().

◆ GetCollisionWidth()

float Unit::GetCollisionWidth ( ) const
overridevirtual

this method gets the diameter of a Unit by DB if any value is defined, otherwise it gets the value by the DBC

If the player is mounted the diameter also takes in consideration the mount size

Returns
float The diameter of a unit

Dismounting case - use basic default model data

Reimplemented from WorldObject.

21189{
21190 if (GetTypeId() == TYPEID_PLAYER)
21191 return GetObjectSize();
21192
21193 float scaleMod = GetObjectScale(); // 99% sure about this
21194 float objectSize = GetObjectSize();
21195 float defaultSize = DEFAULT_WORLD_OBJECT_SIZE * scaleMod;
21196
21198 CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.AssertEntry(GetNativeDisplayId());
21199 CreatureModelDataEntry const* modelData = sCreatureModelDataStore.AssertEntry(displayInfo->ModelId);
21200
21201 if (IsMounted())
21202 {
21204 {
21205 if (CreatureModelDataEntry const* mountModelData = sCreatureModelDataStore.LookupEntry(mountDisplayInfo->ModelId))
21206 {
21207 if (G3D::fuzzyGt(mountModelData->CollisionWidth, modelData->CollisionWidth))
21208 modelData = mountModelData;
21209 }
21210 }
21211 }
21212
21213 float collisionWidth = scaleMod * modelData->CollisionWidth * modelData->Scale * displayInfo->scale * 2;
21214 // if the objectSize is the default value or the creature is mounted and we have a DBC value, then we can retrieve DBC value instead
21215 return G3D::fuzzyGt(collisionWidth, 0.0f) && (G3D::fuzzyEq(objectSize,defaultSize) || IsMounted()) ? collisionWidth : objectSize;
21216}
#define DEFAULT_WORLD_OBJECT_SIZE
Definition: ObjectDefines.h:45
float GetObjectSize() const
Definition: Object.cpp:2734
float CollisionWidth
Definition: DBCStructure.h:790

References CreatureModelDataEntry::CollisionWidth, DEFAULT_WORLD_OBJECT_SIZE, GetNativeDisplayId(), Object::GetObjectScale(), WorldObject::GetObjectSize(), Object::GetTypeId(), Object::GetUInt32Value(), IsMounted(), CreatureDisplayInfoEntry::ModelId, CreatureDisplayInfoEntry::scale, CreatureModelDataEntry::Scale, sCreatureDisplayInfoStore, sCreatureModelDataStore, TYPEID_PLAYER, and UNIT_FIELD_MOUNTDISPLAYID.

Referenced by GetCollisionRadius().

◆ GetCombatRatingDamageReduction()

uint32 Unit::GetCombatRatingDamageReduction ( CombatRating  cr,
float  rate,
float  cap,
uint32  damage 
) const
private
19334{
19335 float percent = std::min(GetCombatRatingReduction(cr) * rate, cap);
19336 return CalculatePct(damage, percent);
19337}
float GetCombatRatingReduction(CombatRating cr) const
Definition: Unit.cpp:19321

References CalculatePct(), and GetCombatRatingReduction().

Referenced by GetMeleeCritDamageReduction(), GetMeleeDamageReduction(), GetRangedCritDamageReduction(), GetRangedDamageReduction(), GetSpellCritDamageReduction(), and GetSpellDamageReduction().

◆ GetCombatRatingReduction()

float Unit::GetCombatRatingReduction ( CombatRating  cr) const
private
19322{
19323 if (Player const* player = ToPlayer())
19324 return player->GetRatingBonusValue(cr);
19325 // Player's pet get resilience from owner
19326 else if (IsPet() && GetOwner())
19327 if (Player* owner = GetOwner()->ToPlayer())
19328 return owner->GetRatingBonusValue(cr);
19329
19330 return 0.0f;
19331}

References GetOwner(), IsPet(), and Object::ToPlayer().

Referenced by GetCombatRatingDamageReduction(), GetMeleeCritChanceReduction(), GetRangedCritChanceReduction(), and GetSpellCritChanceReduction().

◆ GetCombatReach()

◆ GetCombatTimer()

uint32 Unit::GetCombatTimer ( ) const
inline
1698{ return m_CombatTimer; }

References m_CombatTimer.

Referenced by Spell::DoSpellHitOnUnit(), and SetInCombatState().

◆ GetComboPoints() [1/2]

uint8 Unit::GetComboPoints ( ObjectGuid const &  guid) const
inline
2291{ return (m_comboTarget && m_comboTarget->GetGUID() == guid) ? m_comboPoints : 0; }

References Object::GetGUID(), m_comboPoints, and m_comboTarget.

◆ GetComboPoints() [2/2]

uint8 Unit::GetComboPoints ( Unit const *  who = nullptr) const
inline

--------—Combo point system----------------—

2290{ return (who && m_comboTarget != who) ? 0 : m_comboPoints; }

References m_comboPoints, and m_comboTarget.

Referenced by CalcSpellDuration(), SpellEffectInfo::CalcValue(), Spell::CheckCast(), and Spell::EffectSchoolDMG().

◆ GetComboTarget()

Unit * Unit::GetComboTarget ( ) const
inline
2292{ return m_comboTarget; }

References m_comboTarget.

Referenced by Player::DuelComplete(), and HandleProcTriggerSpell().

◆ GetComboTargetGUID()

ObjectGuid const Unit::GetComboTargetGUID ( ) const
inline

◆ GetCreateHealth()

◆ GetCreateMana()

◆ GetCreatePowers()

uint32 Unit::GetCreatePowers ( Powers  power) const
15548{
15549 // Only hunter pets have POWER_FOCUS and POWER_HAPPINESS
15550 switch (power)
15551 {
15552 case POWER_MANA:
15553 return GetCreateMana();
15554 case POWER_RAGE:
15555 return 1000;
15556 case POWER_FOCUS:
15557 return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 100);
15558 case POWER_ENERGY:
15559 return 100;
15560 case POWER_HAPPINESS:
15561 return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 1050000);
15562 case POWER_RUNIC_POWER:
15563 return 1000;
15564 case POWER_RUNE:
15565 return 0;
15566 case POWER_HEALTH:
15567 return 0;
15568 default:
15569 break;
15570 }
15571
15572 return 0;
15573}
@ POWER_HEALTH
Definition: SharedDefines.h:250
@ POWER_RUNIC_POWER
Definition: SharedDefines.h:247
@ POWER_ENERGY
Definition: SharedDefines.h:244
@ POWER_RUNE
Definition: SharedDefines.h:246
@ POWER_FOCUS
Definition: SharedDefines.h:243
uint32 GetCreateMana() const
Definition: Unit.h:2041

References GetCreateMana(), Object::GetTypeId(), HUNTER_PET, IsPet(), POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_HEALTH, POWER_MANA, POWER_RAGE, POWER_RUNE, POWER_RUNIC_POWER, and TYPEID_PLAYER.

Referenced by Pet::CreateBaseAtTamed(), HandleDummyAuraProc(), Player::InitStatsForLevel(), Pet::LoadPetFromDB(), setPowerType(), Guardian::UpdateMaxPower(), and Player::UpdateMaxPower().

◆ GetCreateStat()

float Unit::GetCreateStat ( Stats  stat) const
inline

◆ GetCreatorGUID()

ObjectGuid Unit::GetCreatorGUID ( ) const
inline
@ UNIT_FIELD_CREATEDBY
Definition: UpdateFields.h:91

References Object::GetGuidValue(), and UNIT_FIELD_CREATEDBY.

Referenced by Condition::Meets().

◆ GetCreatureType()

uint32 Unit::GetCreatureType ( ) const
15070{
15071 if (GetTypeId() == TYPEID_PLAYER)
15072 {
15074 SpellShapeshiftEntry const* ssEntry = sSpellShapeshiftStore.LookupEntry(form);
15075 if (ssEntry && ssEntry->creatureType > 0)
15076 return ssEntry->creatureType;
15077 else
15079 }
15080 else
15081 return ToCreature()->GetCreatureTemplate()->type;
15082}
DBCStorage< SpellShapeshiftEntry > sSpellShapeshiftStore(SpellShapeshiftfmt)
ShapeshiftForm
Definition: Unit.h:89
@ CREATURE_TYPE_HUMANOID
Definition: SharedDefines.h:2606
uint32 type
Definition: CreatureData.h:215
ShapeshiftForm GetShapeshiftForm() const
Definition: Unit.h:2071
Definition: DBCStructure.h:1778
int32 creatureType
Definition: DBCStructure.h:1784

References CREATURE_TYPE_HUMANOID, SpellShapeshiftEntry::creatureType, Creature::GetCreatureTemplate(), GetShapeshiftForm(), Object::GetTypeId(), sSpellShapeshiftStore, Object::ToCreature(), CreatureTemplate::type, and TYPEID_PLAYER.

Referenced by Creature::CanStartAttack(), spell_utgarde_pinnacle_beast_mark::CheckProc(), Spell::EffectKnockBack(), spell_dk_death_pact::FilterTargets(), GetCreatureTypeMask(), GetUnitParryChance(), AuraEffect::HandleAuraEmpathy(), spell_dru_starfall_dummy::HandleDummy(), IsCritter(), CreatureAI::MoveInLineOfSight(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnCreatureCreate(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnUnitDeath(), Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck::operator()(), Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator()(), SetInCombatState(), and Creature::UpdateMoveInLineOfSightState().

◆ GetCreatureTypeMask()

uint32 Unit::GetCreatureTypeMask ( ) const
inline
1529 {
1530 uint32 creatureType = GetCreatureType();
1531 return (creatureType >= 1) ? (1 << (creatureType - 1)) : 0;
1532 }
uint32 GetCreatureType() const
Definition: Unit.cpp:15069

References GetCreatureType().

Referenced by CalculateMeleeDamage(), CalculateSpellDamageTaken(), SpellInfo::CheckTargetCreatureType(), MeleeDamageBonusDone(), SpellCriticalDamageBonus(), SpellCriticalHealingBonus(), SpellDamageBonusDone(), SpellPctDamageModsDone(), and SpellTakenCritChance().

◆ GetCritterGUID()

ObjectGuid Unit::GetCritterGUID ( ) const
inline

◆ GetCurrentSpell() [1/2]

◆ GetCurrentSpell() [2/2]

Spell * Unit::GetCurrentSpell ( uint32  spellType) const
inline
2062{ return m_currentSpells[spellType]; }

References m_currentSpells.

◆ GetCurrentSpellCastTime()

int32 Unit::GetCurrentSpellCastTime ( uint32  spell_id) const
4093{
4094 if (Spell const* spell = FindCurrentSpellBySpellId(spell_id))
4095 return spell->GetCastTime();
4096 return 0;
4097}
Spell * FindCurrentSpellBySpellId(uint32 spell_id) const
Definition: Unit.cpp:4084

References FindCurrentSpellBySpellId().

Referenced by CasterAI::EnterCombat(), CasterAI::UpdateAI(), and boss_mandokir::boss_mandokirAI::UpdateAI().

◆ getDeathState()

◆ GetDebugInfo()

std::string Unit::GetDebugInfo ( ) const
overridevirtual

Reimplemented from WorldObject.

21421{
21422 std::stringstream sstr;
21423 sstr << WorldObject::GetDebugInfo() << "\n"
21424 << std::boolalpha
21425 << "AliveState: " << IsAlive()
21426 << " UnitMovementFlags: " << GetUnitMovementFlags() << " ExtraUnitMovementFlags: " << GetExtraUnitMovementFlags()
21427 << " Class: " << std::to_string(getClass());
21428 return sstr.str();
21429}
std::string GetDebugInfo() const override
Definition: Object.cpp:2447

References getClass(), WorldObject::GetDebugInfo(), GetExtraUnitMovementFlags(), GetUnitMovementFlags(), and IsAlive().

Referenced by UnitAI::GetDebugInfo(), Creature::GetDebugInfo(), and Player::GetDebugInfo().

◆ GetDefaultMovementType()

MovementGeneratorType Unit::GetDefaultMovementType ( ) const
virtual

-------—End of Pet responses methods-------—

Reimplemented in Creature.

16794{
16795 return IDLE_MOTION_TYPE;
16796}
@ IDLE_MOTION_TYPE
Definition: MotionMaster.h:37

References IDLE_MOTION_TYPE.

◆ GetDefenseSkillValue()

uint32 Unit::GetDefenseSkillValue ( Unit const *  target = nullptr) const
3579{
3580 if (GetTypeId() == TYPEID_PLAYER)
3581 {
3582 // in PvP use full skill instead current skill value
3583 uint32 value = (target && target->GetTypeId() == TYPEID_PLAYER)
3586 value += uint32(ToPlayer()->GetRatingBonusValue(CR_DEFENSE_SKILL));
3587 return value;
3588 }
3589 else
3590 return GetUnitMeleeSkill(target);
3591}
@ CR_DEFENSE_SKILL
Definition: Unit.h:405
@ SKILL_DEFENSE
Definition: SharedDefines.h:2853
uint16 GetSkillValue(uint32 skill) const
Definition: Player.cpp:5354
uint16 GetMaxSkillValue(uint32 skill) const
Definition: Player.cpp:5371

References CR_DEFENSE_SKILL, Player::GetMaxSkillValue(), Player::GetSkillValue(), Object::GetTypeId(), GetUnitMeleeSkill(), SKILL_DEFENSE, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by spell_pal_ardent_defender::Absorb(), DealMeleeDamage(), GetUnitCriticalChance(), RollMeleeOutcomeAgainst(), SpellTakenCritChance(), Player::UpdateBlockPercentage(), and lfg::LFGMgr::UpdateRaidBrowser().

◆ GetDiminishing()

DiminishingLevels Unit::GetDiminishing ( DiminishingGroup  group)
14895{
14896 for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i)
14897 {
14898 if (i->DRGroup != group)
14899 continue;
14900
14901 if (!i->hitCount)
14902 return DIMINISHING_LEVEL_1;
14903
14904 if (!i->hitTime)
14905 return DIMINISHING_LEVEL_1;
14906
14907 // If last spell was casted more than 15 seconds ago - reset the count.
14908 if (i->stack == 0 && getMSTimeDiff(i->hitTime, GameTime::GetGameTimeMS().count()) > 15000)
14909 {
14910 i->hitCount = DIMINISHING_LEVEL_1;
14911 return DIMINISHING_LEVEL_1;
14912 }
14913 // or else increase the count.
14914 else
14915 return DiminishingLevels(i->hitCount);
14916 }
14917 return DIMINISHING_LEVEL_1;
14918}
uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime)
Definition: Timer.h:110

References DIMINISHING_LEVEL_1, GameTime::GetGameTimeMS(), getMSTimeDiff(), and m_Diminishing.

Referenced by Spell::DoSpellHitOnUnit().

◆ GetDirectTransport()

TransportBase * Unit::GetDirectTransport ( ) const

Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)

18906{
18907 if (Vehicle* veh = GetVehicle())
18908 return veh;
18909 return GetTransport();
18910}
Vehicle * GetVehicle() const
Definition: Unit.h:2354

References WorldObject::GetTransport(), and GetVehicle().

Referenced by Movement::TransportPathTransform::operator()(), SmartScript::ProcessAction(), CharmInfo::SaveStayPosition(), WaypointMovementGenerator< Creature >::StartMove(), and UpdateSplinePosition().

◆ GetDiseasesByCaster()

uint32 Unit::GetDiseasesByCaster ( ObjectGuid  casterGUID,
uint8  mode = 0 
)
5734{
5735 static const AuraType diseaseAuraTypes[] =
5736 {
5737 SPELL_AURA_PERIODIC_DAMAGE, // Frost Fever and Blood Plague
5738 SPELL_AURA_LINKED, // Crypt Fever and Ebon Plague
5740 };
5741
5742 ObjectGuid drwGUID;
5743
5744 if (Player* playerCaster = ObjectAccessor::GetPlayer(*this, casterGUID))
5745 drwGUID = playerCaster->getRuneWeaponGUID();
5746
5747 uint32 diseases = 0;
5748 for (uint8 index = 0; diseaseAuraTypes[index] != SPELL_AURA_NONE; ++index)
5749 {
5750 for (AuraEffectList::iterator i = m_modAuras[diseaseAuraTypes[index]].begin(); i != m_modAuras[diseaseAuraTypes[index]].end();)
5751 {
5752 // Get auras with disease dispel type by caster
5753 if ((*i)->GetSpellInfo()->Dispel == DISPEL_DISEASE
5754 && ((*i)->GetCasterGUID() == casterGUID || (*i)->GetCasterGUID() == drwGUID)) // if its caster or his dancing rune weapon
5755 {
5756 ++diseases;
5757
5758 if (mode == 1)
5759 {
5760 RemoveAura((*i)->GetId(), (*i)->GetCasterGUID());
5761 i = m_modAuras[diseaseAuraTypes[index]].begin();
5762 continue;
5763 }
5764 // used for glyph of scourge strike
5765 else if (mode == 2)
5766 {
5767 Aura* aura = (*i)->GetBase();
5768 if (aura && !aura->IsRemoved() && aura->GetDuration() > 0)
5769 if ((aura->GetApplyTime() + aura->GetMaxDuration() / 1000 + 8) > (GameTime::GetGameTime().count() + aura->GetDuration() / 1000))
5770 aura->SetDuration(aura->GetDuration() + 3000);
5771 }
5772 }
5773 ++i;
5774 }
5775 }
5776 return diseases;
5777}
AuraType
Definition: SpellAuraDefines.h:62
@ SPELL_AURA_LINKED
Definition: SpellAuraDefines.h:347
@ SPELL_AURA_NONE
Definition: SpellAuraDefines.h:63
@ DISPEL_DISEASE
Definition: SharedDefines.h:1347
int32 GetMaxDuration() const
Definition: SpellAuras.h:129
time_t GetApplyTime() const
Definition: SpellAuras.h:128

References DISPEL_DISEASE, Aura::GetApplyTime(), Aura::GetDuration(), GameTime::GetGameTime(), Aura::GetMaxDuration(), ObjectAccessor::GetPlayer(), Aura::IsRemoved(), m_modAuras, RemoveAura(), Aura::SetDuration(), SPELL_AURA_LINKED, SPELL_AURA_NONE, and SPELL_AURA_PERIODIC_DAMAGE.

Referenced by Spell::EffectWeaponDmg(), MeleeDamageBonusDone(), and SpellPctDamageModsDone().

◆ GetDispellableAuraList()

void Unit::GetDispellableAuraList ( Unit caster,
uint32  dispelMask,
DispelChargesList dispelList 
)
5524{
5525 // we should not be able to dispel diseases if the target is affected by unholy blight
5526 if (dispelMask & (1 << DISPEL_DISEASE) && HasAura(50536))
5527 dispelMask &= ~(1 << DISPEL_DISEASE);
5528
5529 ReputationRank rank = GetReactionTo(caster, IsCharmed());
5530 bool positive = rank >= REP_FRIENDLY;
5531
5532 // Neutral unit not at war with caster should be treated as a friendly unit
5533 if (rank == REP_NEUTRAL)
5534 {
5535 if (Player* casterPlayer = caster->GetAffectingPlayer())
5536 {
5537 if (FactionTemplateEntry const* factionTemplateEntry = GetFactionTemplateEntry())
5538 {
5539 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
5540 {
5541 if (factionEntry->CanBeSetAtWar())
5542 {
5543 positive = !casterPlayer->GetReputationMgr().IsAtWar(factionEntry);
5544 }
5545 }
5546 }
5547 }
5548 }
5549
5550 Unit::VisibleAuraMap const* visibleAuras = GetVisibleAuras();
5551 for (Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin(); itr != visibleAuras->end(); ++itr)
5552 {
5553 Aura* aura = itr->second->GetBase();
5554
5555 // don't try to remove passive auras
5556 if (aura->IsPassive())
5557 continue;
5558
5559 if (aura->GetSpellInfo()->GetDispelMask() & dispelMask)
5560 {
5561 if (aura->GetSpellInfo()->Dispel == DISPEL_MAGIC)
5562 {
5563 // do not remove positive auras if friendly target
5564 // negative auras if non-friendly target
5565 if (itr->second->IsPositive() == positive)
5566 continue;
5567 }
5568
5569 // The charges / stack amounts don't count towards the total number of auras that can be dispelled.
5570 // Ie: A dispel on a target with 5 stacks of Winters Chill and a Polymorph has 1 / (1 + 1) -> 50% chance to dispell
5571 // Polymorph instead of 1 / (5 + 1) -> 16%.
5572 bool dispel_charges = aura->GetSpellInfo()->HasAttribute(SPELL_ATTR7_DISPEL_REMOVES_CHARGES);
5573 uint8 charges = dispel_charges ? aura->GetCharges() : aura->GetStackAmount();
5574 if (charges > 0)
5575 dispelList.push_back(std::make_pair(aura, charges));
5576 }
5577 }
5578}
@ SPELL_ATTR7_DISPEL_REMOVES_CHARGES
Definition: SharedDefines.h:623
@ REP_FRIENDLY
Definition: SharedDefines.h:156
@ DISPEL_MAGIC
Definition: SharedDefines.h:1345
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5610
std::map< uint8, AuraApplication * > VisibleAuraMap
Definition: Unit.h:1312
VisibleAuraMap const * GetVisibleAuras()
Definition: Unit.h:2151
uint8 GetStackAmount() const
Definition: SpellAuras.h:148
uint8 GetCharges() const
Definition: SpellAuras.h:141
bool IsPassive() const
Definition: SpellAuras.cpp:1096
uint32 Dispel
Definition: SpellInfo.h:320

References SpellInfo::Dispel, DISPEL_DISEASE, DISPEL_MAGIC, GetAffectingPlayer(), Aura::GetCharges(), SpellInfo::GetDispelMask(), GetFactionTemplateEntry(), GetReactionTo(), Aura::GetSpellInfo(), Aura::GetStackAmount(), GetVisibleAuras(), SpellInfo::HasAttribute(), HasAura(), IsCharmed(), Aura::IsPassive(), REP_FRIENDLY, REP_NEUTRAL, sFactionStore, and SPELL_ATTR7_DISPEL_REMOVES_CHARGES.

Referenced by Spell::EffectDispel().

◆ GetDisplayId()

uint32 Unit::GetDisplayId ( ) const
inline

References Object::GetUInt32Value(), and UNIT_FIELD_DISPLAYID.

Referenced by boss_jormungarAI::AttackStart(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::AttackStart(), WorldSession::BuildPartyMemberStatsChangedPacket(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::CanAIAttack(), Pet::CreateBaseAtCreature(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::DamageTaken(), boss_jormungarAI::DoAction(), npc_scholomance_occultist::npc_scholomance_occultistAI::EnterCombat(), AuraEffect::HandleAuraCloneCaster(), spell_gen_model_visible::HandleEffectApply(), WorldSession::HandleMirrorImageDataRequest(), npc_commandscript::HandleNpcGuidCommand(), npc_commandscript::HandleNpcInfoCommand(), WorldSession::HandleRequestPartyMemberStatsOpcode(), spell_death_knight_initiate_visual::HandleScriptEffect(), wp_commandscript::HandleWpShowCommand(), Guardian::InitStatsForLevel(), IsInDisallowedMountForm(), boss_tharon_ja::boss_tharon_jaAI::JustDied(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::KilledUnit(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::KilledUnit(), boss_devourer_of_souls::boss_devourer_of_soulsAI::KilledUnit(), achievement_less_rabi::OnCheck(), WretchedGhoulCleaner::operator()(), boss_jormungarAI::ScheduleEvents(), Creature::SetObjectScale(), boss_halion::boss_halionAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::UpdateAI(), and boss_high_astromancer_solarian::boss_high_astromancer_solarianAI::UpdateAI().

◆ GetDoTsByCaster()

uint32 Unit::GetDoTsByCaster ( ObjectGuid  casterGUID) const
5780{
5781 static const AuraType diseaseAuraTypes[] =
5782 {
5786 };
5787
5788 uint32 dots = 0;
5789 for (AuraType const* itr = &diseaseAuraTypes[0]; itr && itr[0] != SPELL_AURA_NONE; ++itr)
5790 {
5791 Unit::AuraEffectList const& auras = GetAuraEffectsByType(*itr);
5792 for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
5793 {
5794 // Get auras by caster
5795 if ((*i)->GetCasterGUID() == casterGUID)
5796 ++dots;
5797 }
5798 }
5799 return dots;
5800}
@ SPELL_AURA_PERIODIC_DAMAGE_PERCENT
Definition: SpellAuraDefines.h:152

References GetAuraEffectsByType(), SPELL_AURA_NONE, SPELL_AURA_PERIODIC_DAMAGE, and SPELL_AURA_PERIODIC_DAMAGE_PERCENT.

Referenced by SpellPctDamageModsDone().

◆ GetDummyAuraEffect()

◆ GetDynamicFlags()

◆ GetDynObject()

DynamicObject * Unit::GetDynObject ( uint32  spellId)
6041{
6042 if (m_dynObj.empty())
6043 return nullptr;
6044 for (DynObjectList::const_iterator i = m_dynObj.begin(); i != m_dynObj.end(); ++i)
6045 {
6046 DynamicObject* dynObj = *i;
6047 if (dynObj->GetSpellId() == spellId)
6048 return dynObj;
6049 }
6050 return nullptr;
6051}
Definition: DynamicObject.h:35
uint32 GetSpellId() const
Definition: DynamicObject.h:58

References DynamicObject::GetSpellId(), and m_dynObj.

Referenced by Spell::DelayedChannel(), and WorldSession::HandleFarSightOpcode().

◆ GetEffectiveResistChance()

float Unit::GetEffectiveResistChance ( Unit const *  owner,
SpellSchoolMask  schoolMask,
Unit const *  victim 
)
static
2084{
2085 float victimResistance = float(victim->GetResistance(schoolMask));
2086 if (owner)
2087 {
2088 // Xinef: pets inherit 100% of masters penetration
2089 // Xinef: excluding traps
2090 Player const* player = owner->GetSpellModOwner();
2091 if (player && owner->GetEntry() != WORLD_TRIGGER)
2092 {
2093 victimResistance += float(player->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
2094 victimResistance -= float(player->GetSpellPenetrationItemMod());
2095 }
2096 else
2097 victimResistance += float(owner->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
2098 }
2099
2100 victimResistance = std::max(victimResistance, 0.0f);
2101 if (owner)
2102 victimResistance += std::max((float(victim->GetLevel()) - float(owner->GetLevel())) * 5.0f, 0.0f);
2103
2104 static uint32 const BOSS_LEVEL = 83;
2105 static float const BOSS_RESISTANCE_CONSTANT = 510.0f;
2106 uint32 level = victim->GetLevel();
2107 float resistanceConstant = 0.0f;
2108
2109 if (level == BOSS_LEVEL)
2110 resistanceConstant = BOSS_RESISTANCE_CONSTANT;
2111 else
2112 resistanceConstant = level * 5.0f;
2113
2114 return victimResistance / (victimResistance + resistanceConstant);
2115}
int32 GetSpellPenetrationItemMod() const
Definition: Player.h:1922

References Object::GetEntry(), GetLevel(), GetResistance(), GetSpellModOwner(), Player::GetSpellPenetrationItemMod(), GetTotalAuraModifierByMiscMask(), SPELL_AURA_MOD_TARGET_RESISTANCE, and WORLD_TRIGGER.

Referenced by CalcAbsorbResist(), and MagicSpellHitResult().

◆ GetExtraUnitMovementFlags()

uint16 Unit::GetExtraUnitMovementFlags ( ) const
inline

◆ GetFaction()

uint32 Unit::GetFaction ( ) const
inline

References Object::GetUInt32Value(), and UNIT_FIELD_FACTIONTEMPLATE.

Referenced by npc_av_marshal_or_warmaster::npc_av_marshal_or_warmasterAI::AttackStart(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::AttackStart(), BuildValuesUpdate(), Creature::CanAssistTo(), spell_q10985_light_of_the_naaru::CheckProc(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), Spell::EffectDuel(), Spell::EffectSummonType(), npc_av_marshal_or_warmaster::npc_av_marshal_or_warmasterAI::EnterEvadeMode(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::EnterEvadeMode(), AuctionListItemsDelayEvent::Execute(), GetFactionTemplateEntry(), GetReactionTo(), WorldSession::HandleAuctionListBidderItems(), WorldSession::HandleAuctionListOwnerItemsEvent(), WorldSession::HandleAuctionPlaceBid(), WorldSession::HandleAuctionRemoveItem(), WorldSession::HandleAuctionSellItem(), WorldSession::HandleGossipHelloOpcode(), modify_commandscript::HandleModifyFactionCommand(), npc_commandscript::HandleNpcGuidCommand(), npc_commandscript::HandleNpcInfoCommand(), WorldSession::HandlePlayerLoginFromDB(), TempSummon::InitStats(), InitTamedPet(), IsInPartyWith(), IsInRaidWith(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::JustDied(), npc_escortAI::JustRespawned(), FollowerAI::JustRespawned(), SmartAI::JustRespawned(), boss_volkhan::boss_volkhanAI::JustSummoned(), boss_balinda::boss_balindaAI::JustSummoned(), boss_archimonde::boss_archimondeAI::JustSummoned(), Pet::LoadPetFromDB(), npc_bartleby::npc_bartlebyAI::npc_bartlebyAI(), npc_cooshcoosh::npc_cooshcooshAI::npc_cooshcooshAI(), npc_floon::npc_floonAI::npc_floonAI(), npc_plucky::npc_pluckyAI::npc_pluckyAI(), npc_raliq_the_drunk::npc_raliq_the_drunkAI::npc_raliq_the_drunkAI(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::npc_taskmaster_fizzuleAI(), instance_eye_of_eternity::instance_eye_of_eternity_InstanceMapScript::OnPlayerEnter(), npc_eris_hevenfire::OnQuestAccept(), npc_cork_gizelton::OnQuestAccept(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::PassengerBoarded(), npc_frosthound::npc_frosthoundAI::PassengerBoarded(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::ReceiveEmote(), npc_bartleby::npc_bartlebyAI::Reset(), npc_plucky::npc_pluckyAI::Reset(), npc_swarm_scarab::npc_swarm_scarabAI::Reset(), npc_future_you::npc_future_youAI::Reset(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::Reset(), npc_floon::npc_floonAI::Reset(), npc_cooshcoosh::npc_cooshcooshAI::Reset(), WorldSession::SendAuctionHello(), SetCharmedBy(), Player::SetGameMaster(), Spell::SummonGuardian(), boss_malchezaar::boss_malchezaarAI::SummonInfernal(), Player::SummonPet(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), boss_shade_of_aran::boss_aranAI::UpdateAI(), boss_archimonde::boss_archimondeAI::UpdateAI(), npc_giant_infernal::npc_giant_infernalAI::UpdateAI(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::UpdateAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::UpdateAI(), and Creature::UpdateMoveInLineOfSightState().

◆ GetFactionReactionTo()

ReputationRank Unit::GetFactionReactionTo ( FactionTemplateEntry const *  factionTemplateEntry,
Unit const *  target 
) const
10158{
10159 // always neutral when no template entry found
10160 if (!factionTemplateEntry)
10161 return REP_NEUTRAL;
10162
10163 FactionTemplateEntry const* targetFactionTemplateEntry = target->GetFactionTemplateEntry();
10164 if (!targetFactionTemplateEntry)
10165 return REP_NEUTRAL;
10166
10167 // xinef: check forced reputation for self also
10168 if (Player const* selfPlayerOwner = GetAffectingPlayer())
10169 if (ReputationRank const* repRank = selfPlayerOwner->GetReputationMgr().GetForcedRankIfAny(target->GetFactionTemplateEntry()))
10170 return *repRank;
10171
10172 if (Player const* targetPlayerOwner = target->GetAffectingPlayer())
10173 {
10174 // check contested flags
10175 if (factionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS
10176 && targetPlayerOwner->HasPlayerFlag(PLAYER_FLAGS_CONTESTED_PVP))
10177 return REP_HOSTILE;
10178 if (ReputationRank const* repRank = targetPlayerOwner->GetReputationMgr().GetForcedRankIfAny(factionTemplateEntry))
10179 return *repRank;
10180 if (!target->HasUnitFlag2(UNIT_FLAG2_IGNORE_REPUTATION))
10181 {
10182 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
10183 {
10184 if (factionEntry->CanHaveReputation())
10185 {
10186 // CvP case - check reputation, don't allow state higher than neutral when at war
10187 ReputationRank repRank = targetPlayerOwner->GetReputationMgr().GetRank(factionEntry);
10188 if (targetPlayerOwner->GetReputationMgr().IsAtWar(factionEntry))
10189 repRank = std::min(REP_NEUTRAL, repRank);
10190 return repRank;
10191 }
10192 }
10193 }
10194 }
10195
10196 // common faction based check
10197 if (factionTemplateEntry->IsHostileTo(*targetFactionTemplateEntry))
10198 return REP_HOSTILE;
10199 if (factionTemplateEntry->IsFriendlyTo(*targetFactionTemplateEntry))
10200 return REP_FRIENDLY;
10201 if (targetFactionTemplateEntry->IsFriendlyTo(*factionTemplateEntry))
10202 return REP_FRIENDLY;
10203 if (factionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_HATES_ALL_EXCEPT_FRIENDS)
10204 return REP_HOSTILE;
10205 // neutral by default
10206 return REP_NEUTRAL;
10207}
@ PLAYER_FLAGS_CONTESTED_PVP
Definition: Player.h:483
@ UNIT_FLAG2_IGNORE_REPUTATION
Definition: Unit.h:490
@ FACTION_TEMPLATE_FLAG_HATES_ALL_EXCEPT_FRIENDS
Definition: DBCEnums.h:337
@ FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS
Definition: DBCEnums.h:336

References FactionTemplateEntry::faction, FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS, FACTION_TEMPLATE_FLAG_HATES_ALL_EXCEPT_FRIENDS, FactionTemplateEntry::factionFlags, GetAffectingPlayer(), GetFactionTemplateEntry(), HasUnitFlag2(), FactionTemplateEntry::IsFriendlyTo(), FactionTemplateEntry::IsHostileTo(), PLAYER_FLAGS_CONTESTED_PVP, REP_FRIENDLY, REP_HOSTILE, REP_NEUTRAL, sFactionStore, and UNIT_FLAG2_IGNORE_REPUTATION.

Referenced by GetReactionTo().

◆ GetFactionTemplateEntry()

FactionTemplateEntry const * Unit::GetFactionTemplateEntry ( ) const
10008{
10009 FactionTemplateEntry const* entry = sFactionTemplateStore.LookupEntry(GetFaction());
10010 if (!entry)
10011 {
10012 static ObjectGuid guid; // prevent repeating spam same faction problem
10013
10014 if (GetGUID() != guid)
10015 {
10016 if (Player const* player = ToPlayer())
10017 LOG_ERROR("entities.unit", "Player {} has invalid faction (faction template id) #{}", player->GetName(), GetFaction());
10018 else if (Creature const* creature = ToCreature())
10019 LOG_ERROR("entities.unit", "Creature (template id: {}) has invalid faction (faction template id) #{}", creature->GetCreatureTemplate()->Entry, GetFaction());
10020 else
10021 LOG_ERROR("entities.unit", "Unit (name={}, type={}) has invalid faction (faction template id) #{}", GetName(), uint32(GetTypeId()), GetFaction());
10022
10023 guid = GetGUID();
10024 }
10025 }
10026 return entry;
10027}
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
std::string const & GetName() const
Definition: Object.h:446

References GetFaction(), Object::GetGUID(), WorldObject::GetName(), Object::GetTypeId(), LOG_ERROR, sFactionTemplateStore, Object::ToCreature(), and Object::ToPlayer().

Referenced by _IsValidAttackTarget(), BuildValuesUpdate(), Player::CanUseBattlegroundObject(), HostileRefMgr::deleteReferencesForFaction(), Spell::EffectGameObjectDamage(), GetDispellableAuraList(), GetFactionReactionTo(), GetReactionTo(), Player::GetReputationPriceDiscount(), IsContestedGuard(), IsHostileToPlayers(), and IsNeutralToAll().

◆ GetFirstControlled()

Unit * Unit::GetFirstControlled ( ) const
11036{
11037 // Sequence: charmed, pet, other guardians
11038 Unit* unit = GetCharm();
11039 if (!unit)
11040 if (ObjectGuid guid = GetMinionGUID())
11041 unit = ObjectAccessor::GetUnit(*this, guid);
11042
11043 return unit;
11044}
ObjectGuid GetMinionGUID() const
Definition: Unit.h:1818

References GetCharm(), GetMinionGUID(), and ObjectAccessor::GetUnit().

Referenced by Player::CharmSpellInitialize(), CombatStart(), WorldSession::HandlePetSetAction(), and RemoveCharmedBy().

◆ GetFirstMinion()

Minion * Unit::GetFirstMinion ( ) const
10597{
10598 if (ObjectGuid pet_guid = GetMinionGUID())
10599 {
10600 if (Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, pet_guid))
10601 if (pet->HasUnitTypeMask(UNIT_MASK_MINION))
10602 return (Minion*)pet;
10603
10604 LOG_ERROR("entities.unit", "Unit::GetFirstMinion: Minion {} not exist.", pet_guid.ToString());
10605 const_cast<Unit*>(this)->SetMinionGUID(ObjectGuid::Empty);
10606 }
10607
10608 return nullptr;
10609}
Creature * GetCreatureOrPetOrVehicle(WorldObject const &, ObjectGuid const)
Definition: ObjectAccessor.cpp:239
void SetMinionGUID(ObjectGuid guid)
Definition: Unit.h:1819

References ObjectGuid::Empty, ObjectAccessor::GetCreatureOrPetOrVehicle(), GetMinionGUID(), LOG_ERROR, SetMinionGUID(), and UNIT_MASK_MINION.

Referenced by boss_terestian_illhoof::boss_terestianAI::Reset(), and boss_terestian_illhoof::boss_terestianAI::UpdateAI().

◆ GetFollowAngle()

◆ GetGameObject()

GameObject * Unit::GetGameObject ( uint32  spellId) const
6082{
6083 for (GameObjectList::const_iterator itr = m_gameObj.begin(); itr != m_gameObj.end(); ++itr)
6084 if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr))
6085 if (go->GetSpellId() == spellId)
6086 return go;
6087
6088 return nullptr;
6089}

References ObjectAccessor::GetGameObject(), and m_gameObj.

Referenced by Player::GetGameObjectIfCanInteractWith(), and Player::TeleportTo().

◆ getGender()

◆ GetGuardianPet()

Guardian * Unit::GetGuardianPet ( ) const
10612{
10613 if (ObjectGuid pet_guid = GetPetGUID())
10614 {
10615 if (Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, pet_guid))
10616 if (pet->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
10617 return (Guardian*)pet;
10618
10619 LOG_FATAL("entities.unit", "Unit::GetGuardianPet: Guardian {} not exist.", pet_guid.ToString());
10620 const_cast<Unit*>(this)->SetPetGUID(ObjectGuid::Empty);
10621 }
10622
10623 return nullptr;
10624}
#define LOG_FATAL(filterType__,...)
Definition: Log.h:155
Definition: TemporarySummon.h:95
void SetPetGUID(ObjectGuid guid)
Definition: Unit.h:1823
ObjectGuid GetPetGUID() const
Definition: Unit.h:1824

References ObjectGuid::Empty, ObjectAccessor::GetCreatureOrPetOrVehicle(), GetPetGUID(), LOG_FATAL, SetPetGUID(), and UNIT_MASK_GUARDIAN.

Referenced by spell_hun_check_pet_los::CheckCast(), Spell::CheckCast(), Spell::EffectSummonPet(), GetNextRandomRaidMemberOrPet(), AuraEffect::HandleAuraDummy(), HandleAuraRaidProcFromChargeWithValue(), HandleDummyAuraProc(), AuraEffect::HandleModDamageDone(), WorldSession::HandlePetCastSpellOpcode(), WorldSession::HandlePetSpellAutocastOpcode(), Spell::SelectImplicitCasterObjectTargets(), and SetMinion().

◆ GetHealth()

uint32 Unit::GetHealth ( ) const
inline
@ UNIT_FIELD_HEALTH
Definition: UpdateFields.h:96

References Object::GetUInt32Value(), and UNIT_FIELD_HEALTH.

Referenced by Player::_SaveCharacter(), spell_yogg_saron_protective_gaze::spell_yogg_saron_protective_gaze_AuraScript::Absorb(), spell_pri_guardian_spirit::Absorb(), spell_rog_cheat_death::Absorb(), spell_pal_ardent_defender::Absorb(), boss_twilight_halion::boss_twilight_halionAI::boss_twilight_halionAI(), WorldSession::BuildPartyMemberStatsChangedPacket(), SpellInfo::CalcPowerCost(), Spell::CheckPower(), CountPctFromCurHealth(), boss_eregos::boss_eregosAI::DamageTaken(), boss_gyth::boss_gythAI::DamageTaken(), boss_razorgore::boss_razorgoreAI::DamageTaken(), boss_majordomo::boss_majordomoAI::DamageTaken(), boss_ragnaros::boss_ragnarosAI::DamageTaken(), npc_mc_core_hound::npc_mc_core_houndAI::DamageTaken(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::DamageTaken(), boss_high_inquisitor_whitemane::boss_high_inquisitor_whitemaneAI::DamageTaken(), boss_apothecary_hummel::boss_apothecary_hummelAI::DamageTaken(), boss_kiljaeden::boss_kiljaedenAI::DamageTaken(), boss_muru::boss_muruAI::DamageTaken(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::DamageTaken(), boss_halazzi::boss_halazziAI::DamageTaken(), npc_halazzi_lynx::npc_halazzi_lynxAI::DamageTaken(), boss_thekal::boss_thekalAI::DamageTaken(), boss_headless_horseman::DamageTaken(), boss_headless_horseman_head::DamageTaken(), npc_amanitar_mushrooms::DamageTaken(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), npc_argent_soldier::npc_argent_soldierAI::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_announcer_toc5::npc_announcer_toc5AI::DamageTaken(), npc_frost_sphere::npc_frost_sphereAI::DamageTaken(), boss_ick::boss_ickAI::DamageTaken(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::DamageTaken(), boss_drakkari_colossus::boss_drakkari_colossusAI::DamageTaken(), npc_gunship::npc_gunshipAI::DamageTaken(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DamageTaken(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::DamageTaken(), boss_malygos::boss_malygosAI::DamageTaken(), npc_power_spark::npc_power_sparkAI::DamageTaken(), npc_crystalline_frayer::npc_crystalline_frayerAI::DamageTaken(), npc_collapsing_star::npc_collapsing_starAI::DamageTaken(), boss_freya::boss_freyaAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), boss_razorscale::boss_razorscaleAI::DamageTaken(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::DamageTaken(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::DamageTaken(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::DamageTaken(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::DamageTaken(), boss_illidan_stormrage::boss_illidan_stormrageAI::DamageTaken(), npc_akama_illidan::npc_akama_illidanAI::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), boss_alar::boss_alarAI::DamageTaken(), npc_hor_leader_second::npc_hor_leader_secondAI::DamageTaken(), npc_ice_tomb::npc_ice_tombAI::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), npc_garr_firesworn::npc_garr_fireswornAI::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), boss_kalecgos::boss_kalecgosAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), SmartAI::DamageTaken(), npc_rotting_forest_rager::npc_rotting_forest_ragerAI::DamageTaken(), npc_bartleby::npc_bartlebyAI::DamageTaken(), npc_calvin_montague::npc_calvin_montagueAI::DamageTaken(), boss_sathrovarr::boss_sathrovarrAI::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_kologarn::boss_kologarnAI::DamageTaken(), boss_kologarn_arms::boss_kologarn_armsAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DamageTaken(), DealDamage(), DealMeleeDamage(), boss_xt002::boss_xt002AI::DoAction(), boss_ichoron::boss_ichoronAI::DoAction(), npc_the_scourge_cauldron::npc_the_scourge_cauldronAI::DoDie(), boss_zuljin::boss_zuljinAI::DoMeleeAttackIfReady(), Spell::EffectHealMaxHealth(), Spell::EffectInstaKill(), Pet::FillPetInfo(), boss_supremus::boss_supremusAI::FindHatefulStrikeTarget(), GetHealthGain(), GetHealthPct(), AuraEffect::HandleAuraModIncreaseHealth(), AuraEffect::HandleAuraModIncreaseMaxHealth(), spell_rajaxx_thundercrash::HandleDamageCalc(), misc_commandscript::HandleDieCommand(), HandleDummyAuraProc(), spell_oculus_soar::spell_oculus_soarAuraScript::HandleEffectPeriodic(), Player::HandleFall(), npc_commandscript::HandleNpcInfoCommand(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_item_blood_draining_enchant::HandleProc(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), boss_akilzon::boss_akilzonAI::HandleStormSequence(), HealthAbovePct(), HealthAbovePctHealed(), HealthBelowPct(), HealthBelowPctDamaged(), IsFullHealth(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::JustDied(), npc_dirt_mound::JustSummoned(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustSummoned(), Kill(), ModifyHealth(), npc_enslaved_netherwing_drake::npc_enslaved_netherwing_drakeAI::MovementInform(), spell_xt002_gravity_bomb_aura::spell_xt002_gravity_bomb_aura_AuraScript::OnPeriodic(), Acore::MostHPMissingInRange::operator()(), Acore::MostHPMissingGroupInRange::operator()(), Acore::HealthPctOrderPred::operator()(), boss_priestess_lackey_commonAI::RecalculateThreat(), boss_faction_championsAI::RecalculateThreat(), Creature::RegenerateHealth(), Player::RegenerateHealth(), Creature::ResetPlayerDamageReq(), Player::SaveHealthBeforeDuel(), Pet::SavePetToDB(), Creature::SaveToDB(), SendAttackStateUpdate(), SendSpellNonMeleeDamageLog(), SendSpellNonMeleeReflectLog(), SetMaxHealth(), boss_eadric::boss_eadricAI::SpellHit(), boss_headless_horseman_head::SpellHitTarget(), boss_ouro::Submerge(), boss_ahune::boss_ahuneAI::SummonedCreatureDespawn(), Aura::Update(), boss_zuljin::boss_zuljinAI::UpdateAI(), boss_headless_horseman::UpdateAI(), boss_archimonde::boss_archimondeAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_ahune::boss_ahuneAI::UpdateAI(), npc_phase_hunter::npc_phase_hunterAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_injured_patient::npc_injured_patientAI::UpdateAI(), Player::UpdateCharmedAI(), Creature::UpdateEntry(), and boss_twin_valkyrAI::UpdateSharedHealth().

◆ GetHealthGain()

int32 Unit::GetHealthGain ( int32  dVal)
14031{
14032 int32 gain = 0;
14033
14034 if (dVal == 0)
14035 return 0;
14036
14037 int32 curHealth = (int32)GetHealth();
14038
14039 int32 val = dVal + curHealth;
14040 if (val <= 0)
14041 {
14042 return -curHealth;
14043 }
14044
14045 int32 maxHealth = (int32)GetMaxHealth();
14046
14047 if (val < maxHealth)
14048 gain = dVal;
14049 else if (curHealth != maxHealth)
14050 gain = maxHealth - curHealth;
14051
14052 return gain;
14053}

References GetHealth(), and GetMaxHealth().

Referenced by Spell::DoAllEffectOnTarget().

◆ GetHealthPct()

◆ getHostileRefMgr()

◆ GetHoverHeight()

float Unit::GetHoverHeight ( ) const
inline

◆ GetInterruptMask()

uint32 Unit::GetInterruptMask ( ) const
inline
2162{ return m_interruptMask; }

References m_interruptMask.

◆ GetLastDamagedTargetGuid()

ObjectGuid const & Unit::GetLastDamagedTargetGuid ( ) const
inline
1573{ return _lastDamagedTargetGuid; }

References _lastDamagedTargetGuid.

◆ GetLastExtraAttackSpell()

uint32 Unit::GetLastExtraAttackSpell ( ) const
inline
1570{ return _lastExtraAttackSpell; }

References _lastExtraAttackSpell.

Referenced by HandleProcTriggerSpell().

◆ getLevel()

uint8 Unit::getLevel ( ) const
inline
Deprecated:
Use GetLevel() instead!
@ UNIT_FIELD_LEVEL
Definition: UpdateFields.h:114

References Object::GetUInt32Value(), and UNIT_FIELD_LEVEL.

Referenced by GetLevel(), and PlayerMenu::SendQuestGiverQuestDetails().

◆ GetLevel()

uint8 Unit::GetLevel ( ) const
inline
1420{ return getLevel(); }
uint8 getLevel() const
Definition: Unit.h:1419

References getLevel().

Referenced by Player::_ApplyItemBonuses(), Player::_ApplyWeaponDamage(), KillRewarder::_InitGroupData(), Pet::_LoadAuras(), KillRewarder::_RewardPlayer(), KillRewarder::_RewardXP(), Player::_SaveCharacter(), Player::_SaveStats(), spell_pal_ardent_defender::Absorb(), Pet::addSpell(), Spell::AddUnitTarget(), Player::ApplyEnchantment(), AuraEffect::AuraEffect(), BattlegroundMgr::BuildBattlegroundListPacket(), WorldSession::BuildPartyMemberStatsChangedPacket(), CalcArmorReducedDamage(), SpellInfo::CalcPowerCost(), SpellEffectInfo::CalcRadius(), spell_gen_disabled_above_63::CalculateAmount(), spell_item_arcane_shroud::CalculateAmount(), spell_item_the_eye_of_diminution::CalculateAmount(), CalculateLevelPenalty(), CalculateMeleeDamage(), Player::CalculateMinMaxDamage(), Player::CalculateReputationGain(), Player::CalculateTalentsPoints(), SpellEffectInfo::CalcValue(), Player::CanEquipItem(), Group::CanJoinBattlegroundQueue(), Player::CanSeeStartQuest(), Player::CanUseItem(), Player::CheckAreaExploreAndOutdoor(), spell_hun_tame_beast::CheckCast(), Spell::CheckCast(), Spell::CheckEffectTarget(), spell_gen_proc_above_75::CheckLevel(), spell_gen_proc_reduced_above_60::CheckProc(), spell_item_green_whelp_armor::CheckProc(), Pet::CreateBaseAtTamed(), Player::CreatePet(), CreateTamedPetFrom(), DealMeleeDamage(), DoLowUnlearnCost(), DoMedUnlearnCost(), Spell::DoSpellHitOnUnit(), Spell::EffectAddHonor(), Spell::EffectApplyGlyph(), Spell::EffectDuel(), Spell::EffectEnergize(), Spell::EffectSchoolDMG(), Spell::EffectSkinning(), Spell::EffectTameCreature(), Pet::FillPetInfo(), lfg::LFGMgr::FinishDungeon(), Acore::XP::Gain(), Player::GetAverageItemLevel(), Player::GetAverageItemLevelForDF(), Player::GetBarberShopCost(), Player::GetBGAccessByLevel(), Pet::GetCurrentFoodBenefitLevel(), npc_wg_quest_giver::GetDialogStatus(), Player::GetDodgeFromAgility(), GetEffectiveResistChance(), SocialMgr::GetFriendInfo(), getLevelForTarget(), Creature::getLevelForTarget(), GetMaxSkillValueForLevel(), Player::GetMeleeCritFromAgility(), Pet::GetNativeObjectScale(), Player::GetQuestDialogStatus(), Player::GetQuestLevel(), Player::GetRatingMultiplier(), Creature::GetShieldBlockValue(), Player::GetSpellCritFromIntellect(), Player::GetsRecruitAFriendBonus(), Player::GetTrainerSpellState(), GetUnitMeleeSkill(), Player::GiveLevel(), Pet::GivePetLevel(), Pet::GivePetXP(), Player::GiveXP(), WorldSession::HandleAcceptGrantLevel(), OutdoorPvPSI::HandleAreaTrigger(), WorldSession::HandleArenaTeamInviteOpcode(), Aura::HandleAuraSpecificMods(), WorldSession::HandleBattleFieldPortOpcode(), WorldSession::HandleBattlefieldStatusOpcode(), WorldSession::HandleBattlemasterJoinArena(), WorldSession::HandleBattlemasterJoinOpcode(), WorldSession::HandleCastSpellOpcode(), Player::HandleDrowning(), WorldSession::HandleGrantLevel(), WorldSession::HandleInitiateTradeOpcode(), WorldSession::HandleLfgPlayerLockInfoRequestOpcode(), Guild::HandleMemberDepositMoney(), Guild::HandleMemberWithdrawMoney(), WorldSession::HandleMessagechatOpcode(), npc_commandscript::HandleNpcInfoCommand(), WorldSession::HandleOfferPetitionOpcode(), WorldSession::HandlePetitionBuyOpcode(), WorldSession::HandlePetitionSignOpcode(), misc_commandscript::HandlePInfoCommand(), WorldSession::HandlePlayerLoginFromDB(), spell_pri_divine_aegis::HandleProc(), WorldSession::HandleRequestPartyMemberStatsOpcode(), reset_commandscript::HandleResetLevelCommand(), spell_wintergrasp_portal::spell_wintergrasp_portal_SpellScript::HandleScript(), spell_item_scroll_of_recall::HandleScript(), WorldSession::HandleSendMail(), player_settings_commandscript::HandleSettingsAnnouncerFlags(), Player::InitGlyphsForLevel(), lfg::LFGMgr::InitializeLockedDungeons(), Pet::InitLevelupSpellsForLevel(), Puppet::InitStats(), TempSummon::InitStats(), Player::InitStatsForLevel(), Pet::InitTalentForLevel(), Player::InitTaxiNodesForLevel(), Battlefield::InvitePlayerToWar(), Creature::isCanTrainingAndResetTalentsOf(), Player::isHonorOrXPTarget(), Player::LearnDefaultSkill(), Pet::LoadPetFromDB(), WorldSession::LogoutPlayer(), AchievementCriteriaData::Meets(), MeleeSpellHitResult(), Player::OCTRegenHPPerSpirit(), Player::OCTRegenMPPerSpirit(), spell_item_with_mount_speed::OnApply(), item_generic_limit_chance_above_60::OnCastItemCombatSpell(), npc_prof_alchemy::OnGossipHello(), npc_prof_blacksmith::OnGossipHello(), npc_prof_leather::OnGossipHello(), npc_prof_tailor::OnGossipHello(), go_evil_book_for_dummies::OnGossipHello(), Player::OnGossipSelect(), QuestApprenticeAnglerPlayerScript::OnPlayerCompleteQuest(), near_scarshield_infiltrator::OnTrigger(), at_scarshield_infiltrator::OnTrigger(), Player::PrepareGossipMenu(), Player::Regenerate(), Player::RegenerateHealth(), Player::RemovedInsignia(), Pet::removeSpell(), Pet::resetTalents(), Player::ResurrectPlayer(), Player::RewardHonor(), Player::RewardQuest(), RewardRage(), Player::RewardReputation(), RollMeleeOutcomeAgainst(), ArenaTeam::Roster(), Player::Satisfy(), Player::SatisfyQuestLevel(), Pet::SavePetToDB(), CalendarMgr::SendCalendarEvent(), CalendarMgr::SendCalendarEventInvite(), WorldSession::SendLfgPlayerReward(), WorldSession::SendLfgRoleCheckUpdate(), Player::SendLoot(), PlayerMenu::SendQuestGiverOfferReward(), PlayerMenu::SendQuestGiverQuestDetails(), PlayerMenu::SendQuestQueryResponse(), Player::SendQuestReward(), ObjectMgr::SendServerMail(), npc_your_inner_turmoil::npc_your_inner_turmoilAI::setphase(), Player::SetRestBonus(), Guild::Member::SetStats(), SpellPctDamageModsDone(), Spell::SummonGuardian(), Player::SummonPet(), Pet::SynchronizeLevelWithOwner(), Aura::Update(), npc_pet_hunter_snake_trap::UpdateAI(), Player::UpdateAttackPowerAndDamage(), Player::UpdateCombatSkills(), Creature::UpdateEntry(), lfg::LFGMgr::UpdateRaidBrowser(), and GameObject::Use().

◆ getLevelForTarget()

◆ GetMagicHitRedirectTarget()

Unit * Unit::GetMagicHitRedirectTarget ( Unit victim,
SpellInfo const *  spellInfo 
)
10980{
10981 // Patch 1.2 notes: Spell Reflection no longer reflects abilities
10982 if (spellInfo->HasAttribute(SPELL_ATTR0_IS_ABILITY) || spellInfo->HasAttribute(SPELL_ATTR1_NO_REDIRECTION) || spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES))
10983 return victim;
10984
10986 for (Unit::AuraEffectList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr)
10987 {
10988 if (Unit* magnet = (*itr)->GetBase()->GetUnitOwner())
10989 if (spellInfo->CheckExplicitTarget(this, magnet) == SPELL_CAST_OK
10990 //&& spellInfo->CheckTarget(this, magnet, false) == SPELL_CAST_OK
10991 && _IsValidAttackTarget(magnet, spellInfo)
10992 /*&& IsWithinLOSInMap(magnet)*/)
10993 {
10994 // Xinef: We should choose minimum between flight time and queue time as in reflect, however we dont know flight time at this point, use arbitrary small number
10995 magnet->m_Events.AddEvent(new RedirectSpellEvent(*magnet, victim->GetGUID(), *itr), magnet->m_Events.CalculateQueueTime(100));
10996
10997 if (magnet->IsTotem())
10998 {
10999 uint64 queueTime = magnet->m_Events.CalculateQueueTime(100);
11000 if (spellInfo->Speed > 0.0f)
11001 {
11002 float dist = GetDistance(magnet->GetPositionX(), magnet->GetPositionY(), magnet->GetPositionZ());
11003 if (dist < 5.0f)
11004 dist = 5.0f;
11005 queueTime = magnet->m_Events.CalculateTime((uint64)floor(dist / spellInfo->Speed * 1000.0f));
11006 }
11007
11008 magnet->m_Events.AddEvent(new KillMagnetEvent(*magnet), queueTime);
11009 }
11010
11011 return magnet;
11012 }
11013 }
11014 return victim;
11015}
std::uint64_t uint64
Definition: Define.h:107
@ SPELL_AURA_SPELL_MAGNET
Definition: SpellAuraDefines.h:159
@ SPELL_ATTR1_NO_REDIRECTION
Definition: SharedDefines.h:394
@ SPELL_ATTR0_IS_ABILITY
Definition: SharedDefines.h:358
@ SPELL_ATTR0_NO_IMMUNITIES
Definition: SharedDefines.h:383
Definition: TotemAI.h:48
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1245
bool _IsValidAttackTarget(Unit const *target, SpellInfo const *bySpell, WorldObject const *obj=nullptr) const
Definition: Unit.cpp:13787
Definition: Unit.h:2667

References _IsValidAttackTarget(), SpellInfo::CheckExplicitTarget(), GetAuraEffectsByType(), WorldObject::GetDistance(), Object::GetGUID(), SpellInfo::HasAttribute(), SpellInfo::Speed, SPELL_ATTR0_IS_ABILITY, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR1_NO_REDIRECTION, SPELL_AURA_SPELL_MAGNET, and SPELL_CAST_OK.

Referenced by Spell::SelectExplicitTargets().

◆ GetMaxHealth()

uint32 Unit::GetMaxHealth ( ) const
inline
@ UNIT_FIELD_MAXHEALTH
Definition: UpdateFields.h:104

References Object::GetUInt32Value(), and UNIT_FIELD_MAXHEALTH.

Referenced by Player::_SaveStats(), boss_twin_valkyrAI::boss_twin_valkyrAI(), boss_viscidus::boss_viscidus(), WorldSession::BuildPartyMemberStatsChangedPacket(), spell_item_skull_of_impeding_doom::CalculateDamageAmount(), CountPctFromMaxHealth(), boss_eregos::boss_eregosAI::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_razorscale::boss_razorscaleAI::DamageTaken(), boss_alar::boss_alarAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), boss_viscidus::DamageTaken(), boss_twinemperorsAI::DamageTaken(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::DamageTaken(), npc_heated_battle::npc_heated_battleAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DamageTaken(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_xt002::boss_xt002AI::DoAction(), npc_xt002_heart::npc_xt002_heartAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), Spell::EffectHealMaxHealth(), Spell::EffectSummonPet(), boss_twin_valkyrAI::EnterCombat(), boss_sister_svalna::boss_sister_svalnaAI::EnterCombat(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::EnterCombat(), boss_prince_keleseth_icc::boss_prince_kelesethAI::EnterCombat(), boss_prince_taldaram_icc::boss_prince_taldaramAI::EnterCombat(), boss_prince_valanar_icc::boss_prince_valanarAI::EnterCombat(), boss_prince_keleseth_icc::boss_prince_kelesethAI::EnterEvadeMode(), boss_prince_taldaram_icc::boss_prince_taldaramAI::EnterEvadeMode(), boss_prince_valanar_icc::boss_prince_valanarAI::EnterEvadeMode(), Acore::XP::Gain(), GetHealthGain(), GetHealthPct(), AuraEffect::HandleAuraModIncreaseHealthPercent(), AuraEffect::HandleAuraModIncreaseMaxHealth(), HandleAuraProc(), misc_commandscript::HandleDamageCommand(), misc_commandscript::HandleDieCommand(), Player::HandleDrowning(), HandleDummyAuraProc(), spell_oculus_soar::spell_oculus_soarAuraScript::HandleEffectPeriodic(), Player::HandleFall(), AuraEffect::HandleModTotalPercentStat(), npc_commandscript::HandleNpcInfoCommand(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), spell_stinky_precious_decimate::spell_stinky_precious_decimate_SpellScript::HandleScript(), IsFullHealth(), boss_prince_valanar_icc::boss_prince_valanarAI::JustReachedHome(), npc_dirt_mound::JustSummoned(), boss_skeram::JustSummoned(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustSummoned(), boss_gluth::boss_gluthAI::KilledUnit(), Creature::LoadCreatureFromDB(), Player::LoadFromDB(), Pet::LoadPetFromDB(), ModifyHealth(), npc_xt002_life_spark::npc_xt002_life_sparkAI::npc_xt002_life_sparkAI(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), Acore::MostHPMissingInRange::operator()(), Acore::MostHPMissingGroupInRange::operator()(), Acore::HealthPctOrderPred::operator()(), Player::outDebugValues(), Player::ProcessDelayedOperations(), SmartScript::ProcessEvent(), boss_priestess_lackey_commonAI::RecalculateThreat(), boss_faction_championsAI::RecalculateThreat(), Creature::RegenerateHealth(), Player::RegenerateHealth(), boss_kalecgos::boss_kalecgosAI::Reset(), boss_prince_keleseth_icc::boss_prince_kelesethAI::Reset(), boss_prince_taldaram_icc::boss_prince_taldaramAI::Reset(), boss_prince_valanar_icc::boss_prince_valanarAI::Reset(), Player::ResetAllPowers(), Player::ResurectUsingRequestData(), Player::ResurrectPlayer(), SetFullHealth(), SetHealth(), boss_headless_horseman::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), npc_simon_bunny::npc_simon_bunnyAI::SpellHitTarget(), boss_viscidus::SummonedCreatureDies(), boss_headless_horseman::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI(), npc_phase_hunter::npc_phase_hunterAI::UpdateAI(), npc_target_dummy::npc_target_dummyAI::UpdateAI(), Creature::UpdateEntry(), and lfg::LFGMgr::UpdateRaidBrowser().

◆ GetMaxNegativeAuraModifier()

int32 Unit::GetMaxNegativeAuraModifier ( AuraType  auratype) const
5862{
5863 int32 modifier = 0;
5864
5865 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5866 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5867 if ((*i)->GetAmount() < modifier)
5868 modifier = (*i)->GetAmount();
5869
5870 return modifier;
5871}

References GetAuraEffectsByType().

Referenced by AuraEffect::HandlePeriodicHealAurasTick(), SpellHealingBonusTaken(), boss_shade_of_akama::boss_shade_of_akamaAI::UpdateAI(), and UpdateSpeed().

◆ GetMaxNegativeAuraModifierByAffectMask()

int32 Unit::GetMaxNegativeAuraModifierByAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
6017{
6018 int32 modifier = 0;
6019
6020 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
6021 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
6022 {
6023 if ((*i)->IsAffectedOnSpell(affectedSpell) && (*i)->GetAmount() < modifier)
6024 modifier = (*i)->GetAmount();
6025 }
6026
6027 return modifier;
6028}

References GetAuraEffectsByType().

◆ GetMaxNegativeAuraModifierByMiscMask()

int32 Unit::GetMaxNegativeAuraModifierByMiscMask ( AuraType  auratype,
uint32  misc_mask 
) const
5913{
5914 int32 modifier = 0;
5915
5916 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5917 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5918 {
5919 if ((*i)->GetMiscValue()& misc_mask && (*i)->GetAmount() < modifier)
5920 modifier = (*i)->GetAmount();
5921 }
5922
5923 return modifier;
5924}

References GetAuraEffectsByType().

Referenced by SpellTakenCritChance().

◆ GetMaxNegativeAuraModifierByMiscValue()

int32 Unit::GetMaxNegativeAuraModifierByMiscValue ( AuraType  auratype,
int32  misc_value 
) const
5965{
5966 int32 modifier = 0;
5967
5968 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5969 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5970 {
5971 if ((*i)->GetMiscValue() == misc_value && (*i)->GetAmount() < modifier)
5972 modifier = (*i)->GetAmount();
5973 }
5974
5975 return modifier;
5976}

References GetAuraEffectsByType().

Referenced by MagicSpellHitResult(), and ModSpellDuration().

◆ GetMaxPositiveAuraModifier()

int32 Unit::GetMaxPositiveAuraModifier ( AuraType  auratype)
5848{
5849 int32 modifier = 0;
5850
5851 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5852 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5853 {
5854 if ((*i)->GetAmount() > modifier)
5855 modifier = (*i)->GetAmount();
5856 }
5857
5858 return modifier;
5859}

References GetAuraEffectsByType().

Referenced by CalculateSpellAmount(), AuraEffect::HandlePeriodicHealAurasTick(), Player::RewardHonor(), SpellHealingBonusTaken(), and UpdateSpeed().

◆ GetMaxPositiveAuraModifierByAffectMask()

int32 Unit::GetMaxPositiveAuraModifierByAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
6003{
6004 int32 modifier = 0;
6005
6006 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
6007 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
6008 {
6009 if ((*i)->IsAffectedOnSpell(affectedSpell) && (*i)->GetAmount() > modifier)
6010 modifier = (*i)->GetAmount();
6011 }
6012
6013 return modifier;
6014}

References GetAuraEffectsByType().

◆ GetMaxPositiveAuraModifierByMiscMask()

int32 Unit::GetMaxPositiveAuraModifierByMiscMask ( AuraType  auratype,
uint32  misc_mask,
const AuraEffect except = nullptr 
) const
5899{
5900 int32 modifier = 0;
5901
5902 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5903 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5904 {
5905 if (except != (*i) && (*i)->GetMiscValue()& misc_mask && (*i)->GetAmount() > modifier)
5906 modifier = (*i)->GetAmount();
5907 }
5908
5909 return modifier;
5910}

References GetAuraEffectsByType(), and AuraEffect::GetMiscValue().

Referenced by AuraEffect::HandleAuraModResistanceExclusive(), and SpellTakenCritChance().

◆ GetMaxPositiveAuraModifierByMiscValue()

int32 Unit::GetMaxPositiveAuraModifierByMiscValue ( AuraType  auratype,
int32  misc_value 
) const
5951{
5952 int32 modifier = 0;
5953
5954 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5955 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5956 {
5957 if ((*i)->GetMiscValue() == misc_value && (*i)->GetAmount() > modifier)
5958 modifier = (*i)->GetAmount();
5959 }
5960
5961 return modifier;
5962}

References GetAuraEffectsByType().

Referenced by MagicSpellHitResult().

◆ GetMaxPower()

uint32 Unit::GetMaxPower ( Powers  power) const
inline
1462{ return GetUInt32Value(static_cast<uint16>(UNIT_FIELD_MAXPOWER1) + power); }
@ UNIT_FIELD_MAXPOWER1
Definition: UpdateFields.h:105

References Object::GetUInt32Value(), and UNIT_FIELD_MAXPOWER1.

Referenced by Player::_SaveStats(), WorldSession::BuildPartyMemberStatsChangedPacket(), SpellInfo::CalcPowerCost(), spell_gen_replenishment_aura::CalculateAmount(), spell_item_skull_of_impeding_doom::CalculateManaLeechAmount(), Spell::CheckItems(), Player::Create(), Spell::EffectEnergize(), Spell::EffectEnergizePct(), Spell::EffectPowerBurn(), Spell::EffectResurrect(), Spell::EffectSelfResurrect(), Spell::EffectSummonPet(), GetPowerPct(), Player::GiveLevel(), HandleAuraProc(), Aura::HandleAuraSpecificMods(), HandleDummyAuraProc(), modify_commandscript::HandleModifyEnergyCommand(), AuraEffect::HandleObsModPowerAuraTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_hun_ascpect_of_the_viper::HandleProc(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), spell_kelthuzad_detonate_mana::spell_kelthuzad_detonate_mana_AuraScript::HandleScript(), spell_gen_pet_summoned::HandleScript(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), Creature::LoadCreatureFromDB(), Player::LoadFromDB(), Pet::LoadPetFromDB(), ModifyPower(), ModifyPowerPct(), Acore::PowerPctOrderPred::operator()(), Player::outDebugValues(), spell_item_oracle_ablutions::PrepareSpellScript(), SmartScript::ProcessAction(), Player::ProcessDelayedOperations(), SmartScript::ProcessEvent(), spell_bronjahm_magic_bane::spell_bronjahm_magic_bane_SpellScript::RecalculateDamage(), Creature::Regenerate(), Player::Regenerate(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::Reset(), Player::ResetAllPowers(), Player::ResurectUsingRequestData(), Player::ResurrectPlayer(), SetPower(), setPowerType(), Player::SummonPet(), boss_curator::boss_curatorAI::UpdateAI(), boss_shade_of_aran::boss_aranAI::UpdateAI(), boss_selin_fireheart::boss_selin_fireheartAI::UpdateAI(), boss_moam::UpdateAI(), boss_faction_championsAI::UpdateAI(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::UpdateAI(), boss_thorim_gauntlet_npcs::boss_thorim_gauntlet_npcsAI::UpdateAI(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::UpdateAI(), npc_dalaran_mage::npc_dalaran_mageAI::UpdateAI(), Player::UpdateCharmedAI(), and lfg::LFGMgr::UpdateRaidBrowser().

◆ GetMaxSkillValueForLevel()

uint16 Unit::GetMaxSkillValueForLevel ( Unit const *  target = nullptr) const
inline
1547{ return (target ? getLevelForTarget(target) : GetLevel()) * 5; }
uint8 getLevelForTarget(WorldObject const *) const override
Definition: Unit.h:1421

References GetLevel(), and getLevelForTarget().

Referenced by Player::GetMaxSkillValueForLevel(), GetUnitCriticalChance(), GetWeaponSkillValue(), isSpellBlocked(), MeleeSpellHitResult(), RollMeleeOutcomeAgainst(), and SpellTakenCritChance().

◆ GetMechanicResistChance()

int32 Unit::GetMechanicResistChance ( SpellInfo const *  spell)
3088{
3089 if (!spell)
3090 return 0;
3091 int32 resist_mech = 0;
3092 for (uint8 eff = 0; eff < MAX_SPELL_EFFECTS; ++eff)
3093 {
3094 if (!spell->Effects[eff].IsEffect())
3095 break;
3096 int32 effect_mech = spell->GetEffectMechanic(eff);
3097 if (effect_mech)
3098 {
3100 if (resist_mech < temp)
3101 resist_mech = temp;
3102 }
3103 }
3104 return resist_mech;
3105}
@ SPELL_AURA_MOD_MECHANIC_RESISTANCE
Definition: SpellAuraDefines.h:180
int32 GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
Definition: Unit.cpp:5926

References SpellInfo::Effects, SpellInfo::GetEffectMechanic(), GetTotalAuraModifierByMiscValue(), MAX_SPELL_EFFECTS, and SPELL_AURA_MOD_MECHANIC_RESISTANCE.

Referenced by MagicSpellHitResult(), and MeleeSpellHitResult().

◆ GetMeleeAttackPoint()

bool Unit::GetMeleeAttackPoint ( Unit attacker,
Position pos 
)
2630{
2631 if (!attacker)
2632 {
2633 return false;
2634 }
2635
2636 AttackerSet attackers = getAttackers();
2637
2638 if (attackers.size() <= 1) // if the attackers are not more than one
2639 {
2640 return false;
2641 }
2642
2643 float meleeReach = GetExactDist2d(attacker);
2644 if (meleeReach <= 0)
2645 {
2646 return false;
2647 }
2648
2649 float minAngle = 0;
2650 Unit *refUnit = nullptr;
2651 uint32 validAttackers = 0;
2652
2653 double attackerSize = attacker->GetCollisionRadius();
2654
2655 for (const auto& otherAttacker: attackers)
2656 {
2657 // if the otherAttacker is not valid, skip
2658 if (!otherAttacker || otherAttacker->GetGUID() == attacker->GetGUID() ||
2659 !otherAttacker->IsWithinMeleeRange(this) || otherAttacker->isMoving())
2660 {
2661 continue;
2662 }
2663
2664 float curretAngle = atan(attacker->GetExactDist2d(otherAttacker) / meleeReach);
2665 if (minAngle == 0 || curretAngle < minAngle)
2666 {
2667 minAngle = curretAngle;
2668 refUnit = otherAttacker;
2669 }
2670
2671 validAttackers++;
2672 }
2673
2674 if (!validAttackers || !refUnit)
2675 {
2676 return false;
2677 }
2678
2679 float contactDist = attackerSize + refUnit->GetCollisionRadius();
2680 float requiredAngle = atan(contactDist / meleeReach);
2681 float attackersAngle = atan(attacker->GetExactDist2d(refUnit) / meleeReach);
2682
2683 // in instance: the more attacker there are, the higher will be the tollerance
2684 // outside: creatures should not intersecate
2685 float angleTollerance = attacker->GetMap()->IsDungeon() ? requiredAngle - requiredAngle * tanh(validAttackers / 5.0f) : requiredAngle;
2686
2687 if (attackersAngle > angleTollerance)
2688 {
2689 return false;
2690 }
2691
2692 double angle = atan(contactDist / meleeReach);
2693
2694 float angularRadius = frand(0.1f, 0.3f) + angle;
2695 int8 direction = (urand(0, 1) ? -1 : 1);
2696 float currentAngle = GetAngle(refUnit);
2697 float absAngle = currentAngle + angularRadius * direction;
2698
2699 float x, y, z;
2700 float distance = meleeReach - GetObjectSize();
2701 GetNearPoint(attacker, x, y, z, distance, 0.0f, absAngle);
2702
2703 if (!GetMap()->CanReachPositionAndGetValidCoords(this, x, y, z, true, true))
2704 {
2705 GetNearPoint(attacker, x, y, z, distance, 0.0f, absAngle * -1); // try the other side
2706
2707 if (!GetMap()->CanReachPositionAndGetValidCoords(this, x, y, z, true, true))
2708 {
2709 return false;
2710 }
2711 }
2712
2713 pos.Relocate(x, y, z);
2714
2715 return true;
2716}
std::int8_t int8
Definition: Define.h:106
float frand(float min, float max)
Definition: Random.cpp:57
void GetNearPoint(WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle, float controlZ=0, Position const *startPos=nullptr) const
Definition: Object.cpp:2589
float GetExactDist2d(const float x, const float y) const
Definition: Position.h:166
float GetCollisionRadius() const override
this method gets the radius of a Unit by DB if any value is defined, otherwise it gets the value by t...
Definition: Unit.cpp:21225
std::unordered_set< Unit * > AttackerSet
Definition: Unit.h:1292
AttackerSet const & getAttackers() const
Definition: Unit.h:1383
bool IsDungeon() const
Definition: Map.h:447

References frand(), Position::GetAngle(), getAttackers(), GetCollisionRadius(), Position::GetExactDist2d(), Object::GetGUID(), WorldObject::GetMap(), WorldObject::GetNearPoint(), WorldObject::GetObjectSize(), Map::IsDungeon(), Position::Relocate(), and urand().

Referenced by MotionMaster::MoveCircleTarget().

◆ GetMeleeCritChanceReduction()

float Unit::GetMeleeCritChanceReduction ( ) const
inline

◆ GetMeleeCritDamageReduction()

uint32 Unit::GetMeleeCritDamageReduction ( uint32  damage) const
inline
1584{ return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_MELEE, 2.2f, 33.0f, damage); }
uint32 GetCombatRatingDamageReduction(CombatRating cr, float rate, float cap, uint32 damage) const
Definition: Unit.cpp:19333

References CR_CRIT_TAKEN_MELEE, and GetCombatRatingDamageReduction().

Referenced by ApplyResilience(), and processDummyAuras().

◆ GetMeleeDamageReduction()

uint32 Unit::GetMeleeDamageReduction ( uint32  damage) const
inline

◆ GetMeleeDamageSchoolMask()

virtual SpellSchoolMask Unit::GetMeleeDamageSchoolMask ( WeaponAttackType  attackType = BASE_ATTACK,
uint8  damageIndex = 0 
) const
pure virtual

Implemented in Player, and Creature.

Referenced by CalculateMeleeDamage().

◆ GetMeleeHitRedirectTarget()

Unit * Unit::GetMeleeHitRedirectTarget ( Unit victim,
SpellInfo const *  spellInfo = nullptr 
)
11018{
11020 for (AuraEffectList::const_iterator i = hitTriggerAuras.begin(); i != hitTriggerAuras.end(); ++i)
11021 {
11022 if (Unit* magnet = (*i)->GetBase()->GetCaster())
11023 if (_IsValidAttackTarget(magnet, spellInfo) && magnet->IsWithinLOSInMap(this)
11024 && (!spellInfo || (spellInfo->CheckExplicitTarget(this, magnet) == SPELL_CAST_OK
11025 && spellInfo->CheckTarget(this, magnet, false) == SPELL_CAST_OK)))
11026 if (roll_chance_i((*i)->GetAmount()))
11027 {
11028 (*i)->GetBase()->DropCharge(AURA_REMOVE_BY_EXPIRE);
11029 return magnet;
11030 }
11031 }
11032 return victim;
11033}
bool roll_chance_i(int chance)
Definition: Random.h:59
@ SPELL_AURA_ADD_CASTER_HIT_TRIGGER
Definition: SpellAuraDefines.h:174

References _IsValidAttackTarget(), AURA_REMOVE_BY_EXPIRE, SpellInfo::CheckExplicitTarget(), SpellInfo::CheckTarget(), GetAuraEffectsByType(), roll_chance_i(), SPELL_AURA_ADD_CASTER_HIT_TRIGGER, and SPELL_CAST_OK.

Referenced by AttackerStateUpdate(), spell_dk_dancing_rune_weapon::HandleProc(), and Spell::SelectExplicitTargets().

◆ GetMeleeRange()

float Unit::GetMeleeRange ( Unit const *  target) const
699{
700 float range = GetCombatReach() + target->GetCombatReach() + 4.0f / 3.0f;
701 return std::max(range, NOMINAL_MELEE_RANGE);
702}
#define NOMINAL_MELEE_RANGE
Definition: ObjectDefines.h:48
float GetCombatReach() const override
Definition: Unit.h:1347

References GetCombatReach(), and NOMINAL_MELEE_RANGE.

Referenced by GetRandomContactPoint(), IsWithinMeleeRange(), and CreatureAI::MoveBackwardsChecks().

◆ GetMeleeReach()

float Unit::GetMeleeReach ( ) const
inline
1348{ float reach = m_floatValues[UNIT_FIELD_COMBATREACH]; return reach > MIN_MELEE_REACH ? reach : MIN_MELEE_REACH; }
#define MIN_MELEE_REACH
Definition: ObjectDefines.h:47

References Object::m_floatValues, MIN_MELEE_REACH, and UNIT_FIELD_COMBATREACH.

Referenced by boss_veknilash::EnterCombat(), and npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI().

◆ GetMinionGUID()

ObjectGuid Unit::GetMinionGUID ( ) const
inline
@ UNIT_FIELD_SUMMON
Definition: UpdateFields.h:87

References Object::GetGuidValue(), and UNIT_FIELD_SUMMON.

Referenced by GetFirstControlled(), GetFirstMinion(), and OutDebugInfo().

◆ GetModelForForm()

uint32 Unit::GetModelForForm ( ShapeshiftForm  form,
uint32  spellId 
) const
19340{
19341 // Hardcoded cases
19342 switch (spellId)
19343 {
19344 case 7090: // Bear form
19345 return 29414;
19346 case 35200: // Roc form
19347 return 4877;
19348 default:
19349 break;
19350 }
19351
19352 if (GetTypeId() == TYPEID_PLAYER)
19353 {
19354 switch (form)
19355 {
19356 case FORM_CAT:
19357 // Based on Hair color
19358 if (getRace() == RACE_NIGHTELF)
19359 {
19360 uint8 hairColor = GetByteValue(PLAYER_BYTES, 3);
19361 switch (hairColor)
19362 {
19363 case 7: // Violet
19364 case 8:
19365 return 29405;
19366 case 3: // Light Blue
19367 return 29406;
19368 case 0: // Green
19369 case 1: // Light Green
19370 case 2: // Dark Green
19371 return 29407;
19372 case 4: // White
19373 return 29408;
19374 default: // original - Dark Blue
19375 return 892;
19376 }
19377 }
19378 // Based on Skin color
19379 else if (getRace() == RACE_TAUREN)
19380 {
19381 uint8 skinColor = GetByteValue(PLAYER_BYTES, 0);
19382 // Male
19383 if (getGender() == GENDER_MALE)
19384 {
19385 switch (skinColor)
19386 {
19387 case 12: // White
19388 case 13:
19389 case 14:
19390 case 18: // Completly White
19391 return 29409;
19392 case 9: // Light Brown
19393 case 10:
19394 case 11:
19395 return 29410;
19396 case 6: // Brown
19397 case 7:
19398 case 8:
19399 return 29411;
19400 case 0: // Dark
19401 case 1:
19402 case 2:
19403 case 3: // Dark Grey
19404 case 4:
19405 case 5:
19406 return 29412;
19407 default: // original - Grey
19408 return 8571;
19409 }
19410 }
19411 // Female
19412 else switch (skinColor)
19413 {
19414 case 10: // White
19415 return 29409;
19416 case 6: // Light Brown
19417 case 7:
19418 return 29410;
19419 case 4: // Brown
19420 case 5:
19421 return 29411;
19422 case 0: // Dark
19423 case 1:
19424 case 2:
19425 case 3:
19426 return 29412;
19427 default: // original - Grey
19428 return 8571;
19429 }
19430 }
19432 return 892;
19433 else
19434 return 8571;
19435 case FORM_DIREBEAR:
19436 case FORM_BEAR:
19437 // Based on Hair color
19438 if (getRace() == RACE_NIGHTELF)
19439 {
19440 uint8 hairColor = GetByteValue(PLAYER_BYTES, 3);
19441 switch (hairColor)
19442 {
19443 case 0: // Green
19444 case 1: // Light Green
19445 case 2: // Dark Green
19446 return 29413; // 29415?
19447 case 6: // Dark Blue
19448 return 29414;
19449 case 4: // White
19450 return 29416;
19451 case 3: // Light Blue
19452 return 29417;
19453 default: // original - Violet
19454 return 2281;
19455 }
19456 }
19457 // Based on Skin color
19458 else if (getRace() == RACE_TAUREN)
19459 {
19460 uint8 skinColor = GetByteValue(PLAYER_BYTES, 0);
19461 // Male
19462 if (getGender() == GENDER_MALE)
19463 {
19464 switch (skinColor)
19465 {
19466 case 0: // Dark (Black)
19467 case 1:
19468 case 2:
19469 return 29418;
19470 case 3: // White
19471 case 4:
19472 case 5:
19473 case 12:
19474 case 13:
19475 case 14:
19476 return 29419;
19477 case 9: // Light Brown/Grey
19478 case 10:
19479 case 11:
19480 case 15:
19481 case 16:
19482 case 17:
19483 return 29420;
19484 case 18: // Completly White
19485 return 29421;
19486 default: // original - Brown
19487 return 2289;
19488 }
19489 }
19490 // Female
19491 else switch (skinColor)
19492 {
19493 case 0: // Dark (Black)
19494 case 1:
19495 return 29418;
19496 case 2: // White
19497 case 3:
19498 return 29419;
19499 case 6: // Light Brown/Grey
19500 case 7:
19501 case 8:
19502 case 9:
19503 return 29420;
19504 case 10: // Completly White
19505 return 29421;
19506 default: // original - Brown
19507 return 2289;
19508 }
19509 }
19511 return 2281;
19512 else
19513 return 2289;
19514 case FORM_FLIGHT:
19516 return 20857;
19517 return 20872;
19518 case FORM_FLIGHT_EPIC:
19520 return 21243;
19521 return 21244;
19522 default:
19523 break;
19524 }
19525 }
19526
19527 uint32 modelid = 0;
19528 SpellShapeshiftEntry const* formEntry = sSpellShapeshiftStore.LookupEntry(form);
19529 if (formEntry && formEntry->modelID_A)
19530 {
19531 // Take the alliance modelid as default
19532 if (GetTypeId() != TYPEID_PLAYER)
19533 return formEntry->modelID_A;
19534 else
19535 {
19537 modelid = formEntry->modelID_A;
19538 else
19539 modelid = formEntry->modelID_H;
19540
19541 // If the player is horde but there are no values for the horde modelid - take the alliance modelid
19542 if (!modelid && Player::TeamIdForRace(getRace()) == TEAM_HORDE)
19543 modelid = formEntry->modelID_A;
19544 }
19545 }
19546
19547 return modelid;
19548}
@ PLAYER_BYTES
Definition: UpdateFields.h:181
@ FORM_DIREBEAR
Definition: Unit.h:98
@ FORM_FLIGHT_EPIC
Definition: Unit.h:115
@ FORM_CAT
Definition: Unit.h:91
@ FORM_FLIGHT
Definition: Unit.h:117
@ FORM_BEAR
Definition: Unit.h:95
@ GENDER_MALE
Definition: SharedDefines.h:60
@ TEAM_ALLIANCE
Definition: SharedDefines.h:732
@ TEAM_HORDE
Definition: SharedDefines.h:733
@ RACE_NIGHTELF
Definition: SharedDefines.h:73
@ RACE_TAUREN
Definition: SharedDefines.h:75
static TeamId TeamIdForRace(uint8 race)
Definition: Player.cpp:5731
uint8 getGender() const
Definition: Unit.h:1428
uint8 getRace(bool original=false) const
Definition: Unit.cpp:21143
uint32 modelID_H
Definition: DBCStructure.h:1788
uint32 modelID_A
Definition: DBCStructure.h:1787

References FORM_BEAR, FORM_CAT, FORM_DIREBEAR, FORM_FLIGHT, FORM_FLIGHT_EPIC, GENDER_MALE, Object::GetByteValue(), getGender(), getRace(), Object::GetTypeId(), SpellShapeshiftEntry::modelID_A, SpellShapeshiftEntry::modelID_H, PLAYER_BYTES, RACE_NIGHTELF, RACE_TAUREN, sSpellShapeshiftStore, TEAM_ALLIANCE, TEAM_HORDE, Player::TeamIdForRace(), and TYPEID_PLAYER.

Referenced by AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraTransform(), and RestoreDisplayId().

◆ GetModelForTotem()

uint32 Unit::GetModelForTotem ( PlayerTotemType  totemType)
19551{
19552 switch (getRace())
19553 {
19554 case RACE_ORC:
19555 {
19556 switch (totemType)
19557 {
19558 case SUMMON_TYPE_TOTEM_FIRE: // fire
19559 return 30758;
19560 case SUMMON_TYPE_TOTEM_EARTH: // earth
19561 return 30757;
19562 case SUMMON_TYPE_TOTEM_WATER: // water
19563 return 30759;
19564 case SUMMON_TYPE_TOTEM_AIR: // air
19565 return 30756;
19566 }
19567 break;
19568 }
19569 case RACE_DWARF:
19570 {
19571 switch (totemType)
19572 {
19573 case SUMMON_TYPE_TOTEM_FIRE: // fire
19574 return 30754;
19575 case SUMMON_TYPE_TOTEM_EARTH: // earth
19576 return 30753;
19577 case SUMMON_TYPE_TOTEM_WATER: // water
19578 return 30755;
19579 case SUMMON_TYPE_TOTEM_AIR: // air
19580 return 30736;
19581 }
19582 break;
19583 }
19584 case RACE_TROLL:
19585 {
19586 switch (totemType)
19587 {
19588 case SUMMON_TYPE_TOTEM_FIRE: // fire
19589 return 30762;
19590 case SUMMON_TYPE_TOTEM_EARTH: // earth
19591 return 30761;
19592 case SUMMON_TYPE_TOTEM_WATER: // water
19593 return 30763;
19594 case SUMMON_TYPE_TOTEM_AIR: // air
19595 return 30760;
19596 }
19597 break;
19598 }
19599 case RACE_TAUREN:
19600 {
19601 switch (totemType)
19602 {
19603 case SUMMON_TYPE_TOTEM_FIRE: // fire
19604 return 4589;
19605 case SUMMON_TYPE_TOTEM_EARTH: // earth
19606 return 4588;
19607 case SUMMON_TYPE_TOTEM_WATER: // water
19608 return 4587;
19609 case SUMMON_TYPE_TOTEM_AIR: // air
19610 return 4590;
19611 }
19612 break;
19613 }
19614 case RACE_DRAENEI:
19615 {
19616 switch (totemType)
19617 {
19618 case SUMMON_TYPE_TOTEM_FIRE: // fire
19619 return 19074;
19620 case SUMMON_TYPE_TOTEM_EARTH: // earth
19621 return 19073;
19622 case SUMMON_TYPE_TOTEM_WATER: // water
19623 return 19075;
19624 case SUMMON_TYPE_TOTEM_AIR: // air
19625 return 19071;
19626 }
19627 break;
19628 }
19629 default: // One standard for other races.
19630 {
19631 switch (totemType)
19632 {
19633 case SUMMON_TYPE_TOTEM_FIRE: // fire
19634 return 4589;
19635 case SUMMON_TYPE_TOTEM_EARTH: // earth
19636 return 4588;
19637 case SUMMON_TYPE_TOTEM_WATER: // water
19638 return 4587;
19639 case SUMMON_TYPE_TOTEM_AIR: // air
19640 return 4590;
19641 }
19642 break;
19643 }
19644 }
19645 return 0;
19646}
@ SUMMON_TYPE_TOTEM_EARTH
Definition: Unit.h:1222
@ SUMMON_TYPE_TOTEM_WATER
Definition: Unit.h:1223
@ SUMMON_TYPE_TOTEM_FIRE
Definition: Unit.h:1221
@ SUMMON_TYPE_TOTEM_AIR
Definition: Unit.h:1224
@ RACE_TROLL
Definition: SharedDefines.h:77
@ RACE_ORC
Definition: SharedDefines.h:71
@ RACE_DRAENEI
Definition: SharedDefines.h:80
@ RACE_DWARF
Definition: SharedDefines.h:72

References getRace(), RACE_DRAENEI, RACE_DWARF, RACE_ORC, RACE_TAUREN, RACE_TROLL, SUMMON_TYPE_TOTEM_AIR, SUMMON_TYPE_TOTEM_EARTH, SUMMON_TYPE_TOTEM_FIRE, and SUMMON_TYPE_TOTEM_WATER.

◆ GetModifierValue()

float Unit::GetModifierValue ( UnitMods  unitMod,
UnitModifierType  modifierType 
) const
15176{
15177 if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END)
15178 {
15179 LOG_ERROR("entities.unit", "attempt to access non-existing modifier value from UnitMods!");
15180 return 0.0f;
15181 }
15182
15183 if (modifierType == TOTAL_PCT && m_auraModifiersGroup[unitMod][modifierType] <= 0.0f)
15184 return 0.0f;
15185
15186 return m_auraModifiersGroup[unitMod][modifierType];
15187}
@ MODIFIER_TYPE_END
Definition: Unit.h:249

References LOG_ERROR, m_auraModifiersGroup, MODIFIER_TYPE_END, TOTAL_PCT, and UNIT_MOD_END.

Referenced by Creature::CalculateMinMaxDamage(), Player::CalculateMinMaxDamage(), Spell::EffectWeaponDmg(), Guardian::UpdateArmor(), Player::UpdateArmor(), Creature::UpdateAttackPowerAndDamage(), Guardian::UpdateAttackPowerAndDamage(), Player::UpdateAttackPowerAndDamage(), Guardian::UpdateDamagePhysical(), Guardian::UpdateMaxHealth(), Player::UpdateMaxHealth(), Guardian::UpdateMaxPower(), Player::UpdateMaxPower(), and Player::UpdateResistances().

◆ GetMotionMaster() [1/2]

MotionMaster * Unit::GetMotionMaster ( )
inline
2262{ return i_motionMaster; }

References i_motionMaster.

Referenced by _ExitVehicle(), HomeMovementGenerator< Creature >::_setTargetLocation(), PetAI::_stopAttack(), BattlegroundAV::AddAVCreature(), npc_mograine::npc_mograineAI::AshbringerEvent(), UnitAI::AttackStart(), FollowerAI::AttackStart(), boss_priestess_lackey_commonAI::AttackStart(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::AttackStart(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::AttackStart(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::AttackStart(), boss_malygos::boss_malygosAI::AttackStart(), npc_nexus_lord::npc_nexus_lordAI::AttackStart(), boss_illidan_stormrage::boss_illidan_stormrageAI::AttackStart(), ArcherAI::AttackStart(), npc_escortAI::AttackStart(), SmartAI::AttackStart(), boss_alyson_antille::boss_alyson_antilleAI::AttackStart(), boss_gazakrothAI::AttackStart(), boss_slither::boss_slitherAI::AttackStart(), npc_zelfrax::npc_zelfraxAI::AttackStart(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::AttackStart(), boss_magus_telestra::boss_magus_telestraAI::AttackStart(), boss_razorscale::boss_razorscaleAI::AttackStart(), boss_high_nethermancer_zerevor::boss_high_nethermancer_zerevorAI::AttackStart(), boss_lady_malande::boss_lady_malandeAI::AttackStart(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::AttackStart(), boss_olm_the_summoner::boss_olm_the_summonerAI::AttackStart(), boss_krosh_firehand::boss_krosh_firehandAI::AttackStart(), npc_millhouse_manastorm::npc_millhouse_manastormAI::AttackStart(), boss_high_astromancer_solarian::boss_high_astromancer_solarianAI::AttackStart(), UnitAI::AttackStartCaster(), boss_professor_putricide::boss_professor_putricideAI::ChangePhase(), CleanupBeforeRemoveFromMap(), boss_isalien::DamageTaken(), npc_mograine::npc_mograineAI::DamageTaken(), boss_ayamiss::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_frost_sphere::npc_frost_sphereAI::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), npc_power_spark::npc_power_sparkAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::DamageTaken(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DestroyDoor(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), npc_icc_spire_frostwyrm::npc_icc_spire_frostwyrmAI::DoAction(), npc_apothecary_genericAI::DoAction(), npc_chained_spirit::DoAction(), npc_twilight_volunteer::DoAction(), boss_taldaram::DoAction(), npc_kinetic_bomb::npc_kinetic_bombAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), npc_saurfang_event::npc_saurfang_eventAI::DoAction(), boss_professor_putricide::boss_professor_putricideAI::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), npc_argent_captainAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), npc_brann_bronzebeard_algalon::npc_brann_bronzebeard_algalonAI::DoAction(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::DoAction(), npc_anubarak_spike::npc_anubarak_spikeAI::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), npc_living_mojo::npc_living_mojoAI::DoAction(), npc_power_spark::npc_power_sparkAI::DoAction(), npc_hover_disk::npc_hover_diskAI::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), boss_skadi::boss_skadiAI::DoAction(), boss_skadi_grauf::boss_skadi_graufAI::DoAction(), npc_akama_illidan::npc_akama_illidanAI::DoAction(), boss_nazan::boss_nazanAI::DoAction(), adyen_the_lightbringer::adyen_the_lightbringerAI::DoAction(), anchorite_karja::anchorite_karjaAI::DoAction(), exarch_orelis::exarch_orelisAI::DoAction(), boss_ghazan::DoAction(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::DoAction(), PetAI::DoAttack(), Creature::DoFleeToGetAssistance(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), ScriptedAI::DoStartMovement(), ScriptedAI::DoStartNoMovement(), go_commandscript::DoTeleport(), Spell::EffectCharge(), Spell::EffectChargeDest(), Spell::EffectDistract(), Spell::EffectJump(), Spell::EffectJumpDest(), Spell::EffectPullTowards(), Spell::EffectSummonType(), npc_zulian_prowler::npc_zulian_prowlerAI::EnterCombat(), boss_jeklik::EnterCombat(), boss_ayamiss::EnterCombat(), boss_jindo::EnterEvadeMode(), boss_jeklik::EnterEvadeMode(), npc_shay_leafrunner::npc_shay_leafrunnerAI::EnterEvadeMode(), boss_professor_putricide::boss_professor_putricideAI::EnterEvadeMode(), npc_argent_captainAI::EnterEvadeMode(), CreatureAI::EnterEvadeMode(), SmartAI::EnterEvadeMode(), GuardAI::EnterEvadeMode(), npc_burning_spirit::npc_burning_spiritAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::EnterEvadeMode(), npc_varian_wrynn::npc_varian_wrynnAI::EnterEvadeMode(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_mrfloppy::npc_mrfloppyAI::EnterEvadeMode(), npc_pet_gen_argent_pony_bridle::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), npc_escortAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), hyjalAI::EnterEvadeMode(), boss_halazzi::boss_halazziAI::EnterPhase(), boss_zuljin::boss_zuljinAI::EnterPhase(), VehicleDespawnEvent::Execute(), RestoreAttack::Execute(), OrcMoveEvent::Execute(), NpcRunToHome::Execute(), UtherBatteredHiltEvent::Execute(), SlaveRunEvent::Execute(), DelayedMovementEvent::Execute(), DaranavanMoveEvent::Execute(), FrostwyrmLandEvent::Execute(), SACActivateEvent::Execute(), startFollow::Execute(), AssistanceMovementGenerator::Finalize(), npc_dark_iron_guzzler::FindNextKeg(), npc_hallows_end_soh::FinishEvent(), npc_rocket_propelled_warhead::npc_rocket_propelled_warheadAI::FinishQuest(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::FlyAway(), Creature::FocusTarget(), CreatureGroup::FormationReset(), boss_volkhan::boss_volkhanAI::GoToAnvil(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), spell_apothecary_lingering_fumes::HandleAfterCast(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), misc_commandscript::HandleAppearCommand(), AuraEffect::HandleAuraAllowFlight(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), misc_commandscript::HandleComeToMeCommand(), spell_q12589_shoot_rjr::spell_q12589_shoot_rjr_SpellScript::HandleDummy(), spell_q11520_discovering_your_roots::HandleDummy(), spell_q11919_q11940_drake_hunt::spell_q11919_q11940_drake_hunt_AuraScript::HandleEffectRemove(), spell_icc_geist_alarm::spell_icc_geist_alarm_SpellScript::HandleEvent(), boss_sartharion_tenebron::boss_sartharion_tenebronAI::HandleExtraEvent(), boss_sartharion_shadron::boss_sartharion_shadronAI::HandleExtraEvent(), boss_sartharion_vesperon::boss_sartharion_vesperonAI::HandleExtraEvent(), go_commandscript::HandleGoGraveyardCommand(), go_commandscript::HandleGoGridCommand(), go_commandscript::HandleGoTicketCommand(), go_commandscript::HandleGoZoneXYCommand(), misc_commandscript::HandleGroupSummonCommand(), boss_malygos::boss_malygosAI::HandleIntroSpeech(), spell_item_toxic_wasteling::HandleJump(), AuraEffect::HandleModPossessPet(), misc_commandscript::HandleMovegensCommand(), WorldSession::HandleMoveTeleportAck(), WorldSession::HandleMoveWorldportAck(), npc_commandscript::HandleNpcFollowCommand(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetWanderDistanceCommand(), npc_commandscript::HandleNpcUnFollowCommand(), spell_item_enchanted_broom_periodic::HandlePeriodicTick(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePlayerLoginFromDB(), spell_entropius_black_hole_effect::spell_entropius_black_hole_effect_SpellScript::HandlePull(), spell_boss_magus_telestra_gravity_well::spell_boss_magus_telestra_gravity_well_SpellScript::HandlePull(), PetAI::HandleReturnMovement(), spell_the_lich_king_valkyr_target_search::spell_the_lich_king_valkyr_target_search_SpellScript::HandleScript(), spell_ayamiss_swarmer_teleport_trigger::HandleScript(), spell_gen_ayamiss_swarmer_loop::HandleScript(), WorldSession::HandleSetRaidDifficultyOpcode(), spell_sindragosa_icy_grip_jump::spell_sindragosa_icy_grip_jump_SpellScript::HandleSpecial(), spell_item_draenic_pale_ale::HandleSummon(), tele_commandscript::HandleTeleCommand(), tele_commandscript::HandleTeleGroupCommand(), wp_commandscript::HandleWpLoadCommand(), wp_commandscript::HandleWpUnLoadCommand(), boss_captain_skarloc::boss_captain_skarlocAI::InitializeAI(), boss_aeonus::boss_aeonusAI::InitializeAI(), boss_glob_of_viscidus::InitializeAI(), npc_troll_volunteer::npc_troll_volunteerAI::InitializeAI(), boss_eck::boss_eckAI::InitializeAI(), npc_preparations_for_war_vehicle::InitializeAI(), npc_bushwhacker::npc_bushwhackerAI::InitializeAI(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::InitializeAI(), npc_pet_dk_dancing_rune_weapon::npc_pet_dk_dancing_rune_weaponAI::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), Totem::InitSummon(), Creature::IsFreeToMove(), IsMutualChase(), boss_gahzranka::boss_gahzrankaAI::IsSummonedBy(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::IsSummonedBy(), npc_burning_spirit::npc_burning_spiritAI::IsSummonedBy(), npc_bone_spike::npc_bone_spikeAI::IsSummonedBy(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), npc_oculus_drake::npc_oculus_drakeAI::IsSummonedBy(), npc_wintergarde_gryphon::IsSummonedBy(), npc_frostbrood_skytalon::npc_frostbrood_skytalonAI::IsSummonedBy(), npc_spirit_shade::npc_spirit_shadeAI::IsSummonedBy(), JumpTo(), npc_frost_wyrm::npc_frost_wyrmAI::JustDied(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), npc_enraged_spirit::npc_enraged_spiritAI::JustDied(), npc_gargoyle::npc_gargoyleAI::JustDied(), boss_ayamiss::JustDied(), SmartAI::JustReachedHome(), npc_rocket_propelled_warhead::npc_rocket_propelled_warheadAI::JustReachedHome(), boss_ghazan::JustReachedHome(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::JustReachedHome(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_kelthuzad::boss_kelthuzadAI::JustSummoned(), boss_auriaya::boss_auriayaAI::JustSummoned(), npc_frosthound::npc_frosthoundAI::JustSummoned(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::JustSummoned(), boss_mekgineer_steamrigger::boss_mekgineer_steamriggerAI::JustSummoned(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), npc_daphne_stilwell::npc_daphne_stilwellAI::JustSummoned(), boss_ichoron::boss_ichoronAI::JustSummoned(), boss_xevozz::boss_xevozzAI::JustSummoned(), npc_hor_lich_king::npc_hor_lich_kingAI::JustSummoned(), npc_ulduar_storm_tempered_keeper::npc_ulduar_storm_tempered_keeperAI::JustSummoned(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::JustSummoned(), boss_vexallus::boss_vexallusAI::JustSummoned(), npc_kalecgos_kj::npc_kalecgos_kjAI::JustSummoned(), boss_captain_skarloc::boss_captain_skarlocAI::JustSummoned(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::JustSummoned(), npc_medivh_bm::npc_medivh_bmAI::JustSummoned(), boss_hadronox::boss_hadronoxAI::JustSummoned(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::JustSummoned(), boss_sartharion::boss_sartharionAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustSummoned(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::JustSummoned(), npc_akama_shade::npc_akamaAI::JustSummoned(), npc_creature_generator_akama::npc_creature_generator_akamaAI::JustSummoned(), boss_supremus::boss_supremusAI::JustSummoned(), boss_fathomlord_karathress::boss_fathomlord_karathressAI::JustSummoned(), boss_lady_vashj::boss_lady_vashjAI::JustSummoned(), boss_kaelthas::boss_kaelthasAI::JustSummoned(), boss_mechano_lord_capacitus::boss_mechano_lord_capacitusAI::JustSummoned(), npc_rinji::npc_rinjiAI::JustSummoned(), boss_archimonde::boss_archimondeAI::JustSummoned(), npc_maghar_captive::npc_maghar_captiveAI::JustSummoned(), boss_ayamiss::JustSummoned(), Player::KillPlayer(), KnockbackFrom(), spell_svalna_revive_champion::spell_svalna_revive_champion_SpellScript::Land(), CreatureGroup::LeaderMoveTo(), Player::LeaveBattleground(), Creature::Motion_Initialize(), CreatureAI::MoveBackwardsChecks(), CreatureAI::MoveCircleChecks(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::MoveInLineOfSight(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MoveInLineOfSight(), PetAI::MovementInform(), boss_ebonroc::boss_ebonrocAI::MovementInform(), boss_bug_trio::MovementInform(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), boss_professor_putricide::boss_professor_putricideAI::MovementInform(), boss_four_horsemen::boss_four_horsemenAI::MovementInform(), npc_fel_guard_hound::npc_fel_guard_houndAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), boss_ghazan::MovementInform(), npc_zelfrax::npc_zelfraxAI::MovementInform(), npc_escortAI::MovementInform(), SmartAI::MovepointReached(), npc_cameron::MoveTheChildren(), boss_four_horsemen::boss_four_horsemenAI::MoveToCorner(), npc_zelfrax::npc_zelfraxAI::MoveToDock(), npc_concentrated_ball::npc_concentrated_ballAI::MoveToNextPoint(), npc_hor_leader_second::npc_hor_leader_secondAI::MoveToNextStopPoint(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MySelectNextTarget(), NearTeleportTo(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::npc_attracted_reef_bullAI(), npc_collapsing_star::npc_collapsing_starAI::npc_collapsing_starAI(), npc_frost_sphere::npc_frost_sphereAI::npc_frost_sphereAI(), npc_omen::npc_omenAI::npc_omenAI(), npc_pos_after_first_boss::npc_pos_after_first_bossAI::npc_pos_after_first_bossAI(), npc_ulduar_saronite_vapors::npc_ulduar_saronite_vaporsAI::npc_ulduar_saronite_vaporsAI(), spell_halion_twilight_phasing::spell_halion_twilight_phasing_AuraScript::OnApply(), instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript::OnCreatureCreate(), npc_ulduar_expedition_commander::OnGossipSelect(), npc_kernobee::OnQuestAccept(), npc_engineer_helice::OnQuestAccept(), spell_chapter5_light_of_dawn_aura::spell_chapter5_light_of_dawn_aura_AuraScript::OnRemove(), spell_halion_twilight_phasing::spell_halion_twilight_phasing_AuraScript::OnRemove(), SplineHandler::operator()(), npc_oculus_drake::npc_oculus_drakeAI::PassengerBoarded(), npc_vics_flying_machine::npc_vics_flying_machineAI::PassengerBoarded(), npc_hover_disk::npc_hover_diskAI::PassengerBoarded(), boss_nefarian::PathEndReached(), PauseMovement(), SmartAI::PausePath(), PetSpellFail(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::PickNewLocation(), NPCStaveQuestAI::PrepareForEncounter(), PretendToDie(), npc_jungle_punch_target::npc_jungle_punch_targetAI::proceedCwEvent(), SmartScript::ProcessAction(), propagateSpeedChange(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), RemoveCharmedBy(), boss_the_beast::boss_thebeastAI::Reset(), boss_nightbane::boss_nightbaneAI::Reset(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::Reset(), boss_kalec::boss_kalecAI::Reset(), npc_janalai_hatchling::npc_janalai_hatchlingAI::Reset(), boss_arlokk::boss_arlokkAI::Reset(), npc_zulian_prowler::npc_zulian_prowlerAI::Reset(), npc_brew_bubble::Reset(), boss_bug_trio::Reset(), boss_jedoga_shadowseeker::Reset(), npc_kinetic_bomb::npc_kinetic_bombAI::Reset(), npc_assembly_lightning::npc_assembly_lightningAI::Reset(), npc_xt002_scrapbot::npc_xt002_scrapbotAI::Reset(), npc_xt002_boombot::npc_xt002_boombotAI::Reset(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), npc_released_offspring_harkoa::npc_released_offspring_harkoaAI::Reset(), npc_infernal_attacker::npc_infernal_attackerAI::Reset(), npc_pet_gen_gnomish_flame_turret::Reset(), kaylaan_the_lost::kaylaan_the_lostAI::ResetDeathblowEvent(), Creature::Respawn(), ResumeMovement(), SmartAI::ResumePath(), Resurrect(), SmartAI::ReturnToLastOOCPos(), npc_escortAI::ReturnToLastPoint(), npc_dream_fog::npc_dream_fogAI::ScheduleEvents(), boss_selin_fireheart::boss_selin_fireheartAI::SelectNearestCrystal(), npc_putricide_oozeAI::SelectNewTarget(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), npc_anubarak_spike::npc_anubarak_spikeAI::SelectNewTarget(), WorldSession::SendDoFlight(), boss_sartharion::boss_sartharionAI::SendLavaWaves(), SetCharmedBy(), SmartAI::SetCombatMove(), SetConfused(), npc_ulduar_expedition_engineer::npc_ulduar_expedition_engineerAI::SetData(), gunship_npc_AI::SetData(), npc_enslaved_proto_drake::npc_enslaved_proto_drakeAI::SetData(), boss_the_beast::boss_thebeastAI::SetData(), npc_eastvale_peasent::SetData(), npc_ulduar_mimiron_rocket::npc_ulduar_mimiron_rocketAI::SetData(), setDeathState(), Creature::setDeathState(), SetFeared(), SmartAI::SetFollow(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), SmartAI::SetForcedCombatMove(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::SetGUID(), SetInCombatState(), Player::SetMover(), SetSpeed(), npc_tirion_fordring_tft::npc_tirion_fordringAI::sGossipSelect(), npc_thassarian2::npc_thassarian2AI::sGossipSelect(), npc_akama_illidan::npc_akama_illidanAI::sGossipSelect(), boss_thorim::boss_thorimAI::SpawnArenaNPCs(), npc_varian_wrynn::npc_varian_wrynnAI::SpawnWave(), npc_thrall_bfu::npc_thrall_bfuAI::SpawnWave(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::SpellHit(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::SpellHit(), npc_saurfang_event::npc_saurfang_eventAI::SpellHit(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), npc_tirion_fordring_tft::npc_tirion_fordringAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), npc_captured_rageclaw::npc_captured_rageclawAI::SpellHit(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), npc_death_knight_initiate::npc_death_knight_initiateAI::SpellHit(), npc_crusade_persuaded::npc_crusade_persuadedAI::SpellHit(), npc_forest_frog::npc_forest_frogAI::SpellHit(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::SpellHit(), npc_troll_volunteer::npc_troll_volunteerAI::SpellHit(), boss_razorscale::boss_razorscaleAI::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), boss_headless_horseman_head::SpellHit(), npc_shay_leafrunner::npc_shay_leafrunnerAI::SpellHit(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::SpellHit(), npc_iron_watcher::npc_iron_watcherAI::SpellHit(), npc_wild_wyrm::npc_wild_wyrmAI::SpellHit(), npc_vengeful_shade::npc_vengeful_shadeAI::SpellHitTarget(), boss_quartermaster_zigris::SpellHitTarget(), boss_volkhan::boss_volkhanAI::SpellHitTarget(), npc_nerubian_burrower::npc_nerubian_burrowerAI::SpellHitTarget(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), boss_attumen::boss_attumenAI::SpellHitTarget(), npc_pet_gen_fetch_ball::SpellHitTarget(), boss_ionar::boss_ionarAI::Split(), npc_belnistrasz::npc_belnistraszAI::sQuestAccept(), npc_shay_leafrunner::npc_shay_leafrunnerAI::sQuestAccept(), npc_escortAI::Start(), instance_violet_hold::instance_violet_hold_InstanceMapScript::StartBossEncounter(), FollowerAI::StartFollow(), WaypointMovementGenerator< Creature >::StartMove(), npc_stillpine_capitive::npc_stillpine_capitiveAI::StartMoving(), SmartAI::StartPath(), SmartAI::StopFollow(), SmartAI::StopPath(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SummonedCreatureDespawn(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), boss_vazruden_the_herald::boss_vazruden_the_heraldAI::SummonedCreatureDies(), boss_jedoga_shadowseeker::SummonedCreatureDies(), Spell::SummonGuardian(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::SummonNextWave(), boss_nightbane::boss_nightbaneAI::TakeOff(), Player::TeleportTo(), CreatureAI::TriggerAlert(), Pet::Update(), Update(), SimpleCharmedAI::UpdateAI(), npc_escortAI::UpdateAI(), boss_gyth::boss_gythAI::UpdateAI(), boss_quartermaster_zigris::UpdateAI(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI(), boss_victor_nefarius::boss_victor_nefariusAI::UpdateAI(), boss_majordomo::boss_majordomoAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_nightbane::boss_nightbaneAI::UpdateAI(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::UpdateAI(), boss_selin_fireheart::boss_selin_fireheartAI::UpdateAI(), npc_eye_of_acherus::UpdateAI(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_unworthy_initiate::npc_unworthy_initiateAI::UpdateAI(), npc_scarlet_courier::npc_scarlet_courierAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), npc_mograine::npc_mograineAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_kalec::boss_kalecAI::UpdateAI(), npc_singularity::npc_singularityAI::UpdateAI(), npc_cameron::UpdateAI(), npc_eastvale_peasent::UpdateAI(), npc_partygoer_pather::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_grand_magister_rommath::npc_grand_magister_rommathAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_akilzon_eagle::npc_akilzon_eagleAI::UpdateAI(), boss_halazzi::boss_halazziAI::UpdateAI(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::UpdateAI(), boss_janalai::boss_janalaiAI::UpdateAI(), npc_janalai_hatcher::npc_janalai_hatcherAI::UpdateAI(), npc_forest_frog::npc_forest_frogAI::UpdateAI(), npc_harrison_jones::npc_harrison_jonesAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), npc_winterfin_playmate::UpdateAI(), npc_snowfall_glade_playmate::UpdateAI(), npc_the_biggest_tree::UpdateAI(), npc_high_oracle_soo_roo::UpdateAI(), npc_elder_kekek::UpdateAI(), npc_the_etymidian::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), boss_headless_horseman::UpdateAI(), npc_doomfire_targetting::npc_doomfire_targettingAI::UpdateAI(), boss_archimonde::boss_archimondeAI::UpdateAI(), npc_giant_infernal::npc_giant_infernalAI::UpdateAI(), npc_frost_wyrm::npc_frost_wyrmAI::UpdateAI(), npc_gargoyle::npc_gargoyleAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_onyxia::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), npc_draenei_survivor::npc_draenei_survivorAI::UpdateAI(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::UpdateAI(), npc_shay_leafrunner::npc_shay_leafrunnerAI::UpdateAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::UpdateAI(), boss_jedoga_shadowseeker::UpdateAI(), npc_twilight_volunteer::UpdateAI(), npc_taldaram_flamesphere::UpdateAI(), boss_hadronox::boss_hadronoxAI::UpdateAI(), npc_xerestrasza::npc_xerestraszaAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_anubarak_spike::npc_anubarak_spikeAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), npc_fos_corrupted_soul_fragment::npc_fos_corrupted_soul_fragmentAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), npc_pos_after_first_boss::npc_pos_after_first_bossAI::UpdateAI(), npc_pos_tyrannus_events::npc_pos_tyrannus_eventsAI::UpdateAI(), npc_pos_leader_second::npc_pos_leader_secondAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), npc_blood_queen_lana_thel::npc_blood_queen_lana_thelAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::UpdateAI(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), npc_valithria_cloud::npc_valithria_cloudAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_power_spark::npc_power_sparkAI::UpdateAI(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), npc_oculus_drakegiver::npc_oculus_drakegiverAI::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), boss_volkhan::boss_volkhanAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), npc_brann_bronzebeard_algalon::npc_brann_bronzebeard_algalonAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_ulduar_emergency_fire_bot::npc_ulduar_emergency_fire_botAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), npc_ulduar_expedition_engineer::npc_ulduar_expedition_engineerAI::UpdateAI(), boss_yoggsaron_death_orb::boss_yoggsaron_death_orbAI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::UpdateAI(), boss_skadi_grauf::boss_skadi_graufAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_preparations_for_war_vehicle::UpdateAI(), npc_shandy_dalaran::npc_shandy_dalaranAI::UpdateAI(), npc_minigob_manabonk::npc_minigob_manabonkAI::UpdateAI(), npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI::UpdateAI(), npc_wintergarde_gryphon::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_commander_eligor_dawnbringer::npc_commander_eligor_dawnbringerAI::UpdateAI(), npc_wounded_skirmisher::UpdateAI(), npc_venture_co_straggler::npc_venture_co_stragglerAI::UpdateAI(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_frostbrood_skytalon::npc_frostbrood_skytalonAI::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), npc_freed_protodrake::npc_freed_protodrakeAI::UpdateAI(), npc_crusade_recruit::npc_crusade_recruitAI::UpdateAI(), npc_voidtraveler::npc_voidtravelerAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_shade_of_akama::boss_shade_of_akamaAI::UpdateAI(), npc_akama_shade::npc_akamaAI::UpdateAI(), boss_lady_vashj::boss_lady_vashjAI::UpdateAI(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::UpdateAI(), boss_omor_the_unscarred::boss_omor_the_unscarredAI::UpdateAI(), boss_nazan::boss_nazanAI::UpdateAI(), boss_warchief_kargath_bladefist::boss_warchief_kargath_bladefistAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), boss_wrath_scryer_soccothrates::boss_wrath_scryer_soccothratesAI::UpdateAI(), boss_high_botanist_freywinn::boss_high_botanist_freywinnAI::UpdateAI(), boss_alar::boss_alarAI::UpdateAI(), boss_high_astromancer_solarian::boss_high_astromancer_solarianAI::UpdateAI(), boss_kaelthas::boss_kaelthasAI::UpdateAI(), npc_nether_drake::npc_nether_drakeAI::UpdateAI(), npc_fel_guard_hound::npc_fel_guard_houndAI::UpdateAI(), socrethar::socretharAI::UpdateAI(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::UpdateAI(), npc_enslaved_netherwing_drake::npc_enslaved_netherwing_drakeAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::UpdateAI(), npc_pet_gen_target_following_bomb::UpdateAI(), npc_pet_gen_wind_rider_cub::UpdateAI(), npc_pet_gen_plump_turkey::UpdateAI(), npc_pet_gen_toxic_wasteling::UpdateAI(), PetAI::UpdateAI(), FollowerAI::UpdateAI(), npc_demonic_vapor::npc_demonic_vaporAI::UpdateAI(), npc_concentrated_ball::npc_concentrated_ballAI::UpdateAI(), npc_xt002_scrapbot::npc_xt002_scrapbotAI::UpdateAI(), npc_xt002_boombot::npc_xt002_boombotAI::UpdateAI(), Player::UpdateCharmedAI(), npc_tooga::npc_toogaAI::UpdateFollowerAI(), and npc_emily::npc_emilyAI::WaypointReached().

◆ GetMotionMaster() [2/2]

const MotionMaster * Unit::GetMotionMaster ( ) const
inline
2263{ return i_motionMaster; }

References i_motionMaster.

◆ GetMountID()

◆ GetNativeDisplayId()

uint32 Unit::GetNativeDisplayId ( ) const
inline

◆ GetNativeObjectScale()

virtual float Unit::GetNativeObjectScale ( ) const
inlinevirtual

Reimplemented in Creature, and Pet.

2166{ return 1.0f; }

Referenced by RecalculateObjectScale().

◆ GetNegStat()

float Unit::GetNegStat ( Stats  stat) const
inline
2044{ return GetFloatValue(static_cast<uint16>(UNIT_FIELD_NEGSTAT0) + stat); }

References Object::GetFloatValue(), and UNIT_FIELD_NEGSTAT0.

◆ GetNextRandomRaidMemberOrPet()

Unit * Unit::GetNextRandomRaidMemberOrPet ( float  radius)
11075{
11076 Player* player = nullptr;
11077 if (GetTypeId() == TYPEID_PLAYER)
11078 player = ToPlayer();
11079 // Should we enable this also for charmed units?
11080 else if (GetTypeId() == TYPEID_UNIT && IsPet())
11081 player = GetOwner()->ToPlayer();
11082
11083 if (!player)
11084 return nullptr;
11085 Group* group = player->GetGroup();
11086 // When there is no group check pet presence
11087 if (!group)
11088 {
11089 // We are pet now, return owner
11090 if (player != this)
11091 return IsWithinDistInMap(player, radius) ? player : nullptr;
11092 Unit* pet = GetGuardianPet();
11093 // No pet, no group, nothing to return
11094 if (!pet)
11095 return nullptr;
11096 // We are owner now, return pet
11097 return IsWithinDistInMap(pet, radius) ? pet : nullptr;
11098 }
11099
11100 std::vector<Unit*> nearMembers;
11101 // reserve place for players and pets because resizing vector every unit push is unefficient (vector is reallocated then)
11102 nearMembers.reserve(group->GetMembersCount() * 2);
11103
11104 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
11105 if (Player* Target = itr->GetSource())
11106 {
11107 if (Target != this && !IsWithinDistInMap(Target, radius))
11108 continue;
11109
11110 // IsHostileTo check duel and controlled by enemy
11111 if (Target != this && Target->IsAlive() && !IsHostileTo(Target))
11112 nearMembers.push_back(Target);
11113
11114 // Push player's pet to vector
11115 if (Unit* pet = Target->GetGuardianPet())
11116 if (pet != this && pet->IsAlive() && IsWithinDistInMap(pet, radius) && !IsHostileTo(pet))
11117 nearMembers.push_back(pet);
11118 }
11119
11120 if (nearMembers.empty())
11121 return nullptr;
11122
11123 uint32 randTarget = urand(0, nearMembers.size() - 1);
11124 return nearMembers[randTarget];
11125}
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition: Object.cpp:1321
Group * GetGroup()
Definition: Player.h:2418
Guardian * GetGuardianPet() const
Definition: Unit.cpp:10611
Definition: Group.h:168
uint32 GetMembersCount() const
Definition: Group.h:244
GroupReference * GetFirstMember()
Definition: Group.h:242
Definition: GroupReference.h:27
GroupReference * next()
Definition: GroupReference.h:36

References Group::GetFirstMember(), Player::GetGroup(), GetGuardianPet(), Group::GetMembersCount(), GetOwner(), Object::GetTypeId(), IsHostileTo(), IsPet(), WorldObject::IsWithinDistInMap(), GroupReference::next(), Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, and urand().

Referenced by HandleAuraRaidProcFromCharge(), and AuraEffect::HandleRaidProcFromChargeAuraProc().

◆ GetNpcFlags()

◆ GetOwnedAura()

Aura * Unit::GetOwnedAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
Aura except = nullptr 
) const
4693{
4694 AuraMapBounds range = m_ownedAuras.equal_range(spellId);
4695 for (AuraMap::const_iterator itr = range.first; itr != range.second; ++itr)
4696 {
4697 if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask)
4698 && (!casterGUID || itr->second->GetCasterGUID() == casterGUID)
4699 && (!itemCasterGUID || itr->second->GetCastItemGUID() == itemCasterGUID)
4700 && (!except || except != itr->second))
4701 {
4702 return itr->second;
4703 }
4704 }
4705 return nullptr;
4706}
std::pair< AuraMap::const_iterator, AuraMap::const_iterator > AuraMapBounds
Definition: Unit.h:1296

References m_ownedAuras.

Referenced by _TryStackingOrRefreshingExistingAura().

◆ GetOwnedAuras() [1/2]

◆ GetOwnedAuras() [2/2]

AuraMap const & Unit::GetOwnedAuras ( ) const
inline
1915{ return m_ownedAuras; }

References m_ownedAuras.

◆ GetOwner()

Unit * Unit::GetOwner ( ) const
10561{
10562 if (ObjectGuid ownerGUID = GetOwnerGUID())
10563 return ObjectAccessor::GetUnit(*this, ownerGUID);
10564
10565 return nullptr;
10566}

References GetOwnerGUID(), and ObjectAccessor::GetUnit().

Referenced by _ExitVehicle(), Acore::AnyAoETargetUnitInObjectRangeCheck::AnyAoETargetUnitInObjectRangeCheck(), ApplyDiminishingToDuration(), ApplyResilience(), TotemAI::AttackStart(), spell_dk_anti_magic_zone::CalculateAmount(), Creature::CanStartAttack(), spell_dk_blood_gorged::CheckProc(), spell_pri_mana_leech::CheckProc(), ClearInPetCombat(), CombatStart(), CombatStartOnCast(), npc_calvin_montague::npc_calvin_montagueAI::DamageTaken(), DealHeal(), HostileRefMgr::deleteReferences(), npc_spring_rabbit::npc_spring_rabbitAI::DoAction(), Spell::DoAllEffectOnLaunchTarget(), Spell::DoAllEffectOnTarget(), PetAI::DoAttack(), Spell::EffectDispel(), Spell::EffectSchoolDMG(), Spell::EffectWeaponDmg(), GetCharmerOrOwner(), GetCombatRatingReduction(), GetNextRandomRaidMemberOrPet(), GetReactionTo(), GetSpellModOwner(), spell_warl_seduction::HandleAuraApply(), HandleAuraRaidProcFromChargeWithValue(), Aura::HandleAuraSpecificMods(), spell_sha_healing_stream_totem::HandleDummy(), spell_q12277_wintergarde_mine_explosion::HandleDummy(), spell_sha_mana_tide_totem::HandleDummy(), HandleDummyAuraProc(), spell_mount_check::spell_mount_check_AuraScript::HandleEffectPeriodic(), spell_gen_gryphon_wyvern_mount_check::HandleEffectPeriodic(), spell_ioc_bomb_blast_criteria::spell_ioc_bomb_blast_criteria_SpellScript::HandleGameObjectDamage(), modify_commandscript::HandleModifyTalentCommand(), WorldSession::HandlePetActionHelper(), HandleProcTriggerSpell(), reset_commandscript::HandleResetTalentsCommand(), spell_hun_pet_heart_of_the_phoenix::HandleScript(), npc_troll_volunteer::npc_troll_volunteerAI::InitializeAI(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::InitializeAI(), npc_pet_dk_dancing_rune_weapon::npc_pet_dk_dancing_rune_weaponAI::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), IsAlwaysVisibleFor(), IsPetAura(), npc_enraged_spirit::npc_enraged_spiritAI::JustDied(), npc_webbed_creature::npc_webbed_creatureAI::JustDied(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::JustDied(), Kill(), MagicSpellHitResult(), MeleeDamageBonusDone(), npc_dkc1_gothik::npc_dkc1_gothikAI::MoveInLineOfSight(), npc_khunok_the_behemoth::npc_khunok_the_behemothAI::MoveInLineOfSight(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MySelectNextTarget(), npc_pet_mage_mirror_image::MySelectNextTarget(), npc_ancestral_wolf::npc_ancestral_wolfAI::npc_ancestral_wolfAI(), npc_pet_gen_soul_trader_beacon::npc_pet_gen_soul_trader_beacon(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), spell_hun_aspect_of_the_beast::OnPetApply(), Acore::MostHPMissingGroupInRange::operator()(), PetSpellFail(), RemoveFromWorld(), npc_target_dummy::npc_target_dummyAI::Reset(), npc_spring_rabbit::npc_spring_rabbitAI::Reset(), RestoreFaction(), Creature::SelectVictim(), SendPetActionFeedback(), SendPetAIReaction(), SendPetTalk(), SetHealth(), SetMaxHealth(), SetMaxPower(), SetPower(), setPowerType(), SetStunned(), SpellDamageBonusDone(), SpellHealingBonusDone(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), SpellPctDamageModsDone(), SpellPctHealingModsDone(), npc_scarlet_courier::npc_scarlet_courierAI::UpdateAI(), npc_pet_gen_wind_rider_cub::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_target_dummy::npc_target_dummyAI::UpdateAI(), and UpdateAuraForGroup().

◆ GetOwnerGUID()

ObjectGuid Unit::GetOwnerGUID ( ) const
inline
@ UNIT_FIELD_SUMMONEDBY
Definition: UpdateFields.h:90

References Object::GetGuidValue(), and UNIT_FIELD_SUMMONEDBY.

Referenced by Pet::AddToWorld(), npc_living_mojo::npc_living_mojoAI::AttackStart(), BuildValuesUpdate(), PetAI::CanAttack(), CanFreeMove(), CanHaveThreatList(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::DamageTaken(), DealDamage(), Spell::DoAllEffectOnTarget(), FollowMovementGenerator< T >::DoUpdate(), GetCharmerOrOwnerGUID(), GetOwner(), AuraEffect::HandleModInvisibility(), AuraEffect::HandleModInvisibilityDetect(), AuraEffect::HandleModStealth(), AuraEffect::HandleModStealthDetect(), AuraEffect::HandleModStealthLevel(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePetRename(), HandleSpellClick(), Creature::HasMechanicTemplateImmunity(), Creature::IsDungeonBoss(), Creature::IsImmuneToKnockback(), isInAccessiblePlaceFor(), Kill(), Creature::LoadSpellTemplateImmunity(), Condition::Meets(), instance_sunwell_plateau::instance_sunwell_plateau_InstanceMapScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), npc_pet_gen_argent_pony_bridle::OnGossipHello(), npc_venomhide_hatchling::OnGossipHello(), Acore::MostHPMissingGroupInRange::operator()(), PlayerOrPetCheck::operator()(), OutDebugInfo(), PetAI::ReceiveEmote(), Creature::Regenerate(), RemoveAllControlled(), RemoveEvadeAuras(), Pet::SavePetToDB(), SetMinion(), SetOwnerGUID(), SpellPctDamageModsDone(), Map::SummonCreature(), NPCStaveQuestAI::UnitIsUnfair(), Creature::Update(), and npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::UpdateAI().

◆ GetPartyMembers()

void Unit::GetPartyMembers ( std::list< Unit * > &  units)
18958{
18959 Unit* owner = GetCharmerOrOwnerOrSelf();
18960 Group* group = nullptr;
18961 if (owner->GetTypeId() == TYPEID_PLAYER)
18962 group = owner->ToPlayer()->GetGroup();
18963
18964 if (group)
18965 {
18966 uint8 subgroup = owner->ToPlayer()->GetSubGroup();
18967
18968 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
18969 {
18970 Player* Target = itr->GetSource();
18971
18972 // IsHostileTo check duel and controlled by enemy
18973 if (Target && Target->IsInMap(owner) && Target->GetSubGroup() == subgroup && !IsHostileTo(Target))
18974 {
18975 if (Target->IsAlive())
18976 TagUnitMap.push_back(Target);
18977
18978 for (Unit::ControlSet::iterator iterator = Target->m_Controlled.begin(); iterator != Target->m_Controlled.end(); ++iterator)
18979 {
18980 if (Unit* pet = *iterator)
18981 if (pet->IsGuardian() && pet->IsAlive())
18982 TagUnitMap.push_back(pet);
18983 }
18984 }
18985 }
18986 }
18987 else
18988 {
18989 if (owner->IsAlive())
18990 TagUnitMap.push_back(owner);
18991
18992 for (Unit::ControlSet::iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr)
18993 {
18994 if (Unit* pet = *itr)
18995 if (pet->IsGuardian() && pet->IsAlive())
18996 TagUnitMap.push_back(pet);
18997 }
18998 }
18999}
uint8 GetSubGroup() const
Definition: Player.h:2422

References GetCharmerOrOwnerOrSelf(), Group::GetFirstMember(), Player::GetGroup(), Player::GetSubGroup(), Object::GetTypeId(), IsAlive(), IsHostileTo(), WorldObject::IsInMap(), m_Controlled, GroupReference::next(), Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by spell_warr_improved_spell_reflection_trigger_aura::HandleRemove().

◆ GetPetGUID()

◆ GetPhaseByAuras()

uint32 Unit::GetPhaseByAuras ( ) const
19177{
19178 uint32 currentPhase = 0;
19180 if (!phases.empty())
19181 for (AuraEffectList::const_iterator itr = phases.begin(); itr != phases.end(); ++itr)
19182 currentPhase |= (*itr)->GetMiscValue();
19183
19184 return currentPhase;
19185}
@ SPELL_AURA_PHASE
Definition: SpellAuraDefines.h:324

References GetAuraEffectsByType(), and SPELL_AURA_PHASE.

Referenced by Player::GetPhaseMaskForSpawn(), AuraEffect::HandlePhase(), and Player::SetGameMaster().

◆ GetPosStat()

float Unit::GetPosStat ( Stats  stat) const
inline
2043{ return GetFloatValue(static_cast<uint16>(UNIT_FIELD_POSSTAT0) + stat); }

References Object::GetFloatValue(), and UNIT_FIELD_POSSTAT0.

◆ GetPower()

uint32 Unit::GetPower ( Powers  power) const
inline
1461{ return GetUInt32Value(static_cast<uint16>(UNIT_FIELD_POWER1) + power); }
@ UNIT_FIELD_POWER1
Definition: UpdateFields.h:97

References Object::GetUInt32Value(), and UNIT_FIELD_POWER1.

Referenced by PetAI::_canMeleeAttack(), Player::_SaveCharacter(), WorldSession::BuildPartyMemberStatsChangedPacket(), SpellInfo::CalcPowerCost(), Spell::CheckItems(), Spell::CheckPower(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), Spell::EffectCastButtons(), Spell::EffectWeaponDmg(), npc_obsidian_destroyer::EnterCombat(), Pet::FillPetInfo(), Pet::GetHappinessState(), GetPowerPct(), Player::GiveLevel(), AuraEffect::HandleAuraModShapeshift(), spell_warr_execute::HandleEffect(), AuraEffect::HandleObsModPowerAuraTick(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), WorldSession::HandlePetAbandon(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), spell_pal_lay_on_hands::HandleScript(), Player::InitStatsForLevel(), spell_gen_replenishment_aura::Load(), Pet::LoseHappiness(), ModifyPower(), spell_mark_of_kazrogal::spell_mark_of_kazrogal_AuraScript::OnPeriodic(), spell_mark_of_kazzak::spell_mark_of_kazzak_AuraScript::OnPeriodic(), Acore::PowerPctOrderPred::operator()(), SmartScript::ProcessAction(), Creature::reachWithSpellAttack(), Creature::reachWithSpellCure(), Creature::Regenerate(), Player::Regenerate(), Creature::RegenerateHealth(), Player::SaveManaBeforeDuel(), Pet::SavePetToDB(), Creature::SaveToDB(), ScriptedAI::SelectSpell(), Spell::SendSpellGo(), Spell::SendSpellStart(), SetMaxPower(), SetPower(), setPowerType(), spell_igb_incinerating_blast::spell_igb_incinerating_blast_SpellScript::StoreEnergy(), Aura::Update(), boss_shade_of_aran::boss_aranAI::UpdateAI(), boss_selin_fireheart::boss_selin_fireheartAI::UpdateAI(), boss_moam::UpdateAI(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::UpdateAI(), boss_thorim_gauntlet_npcs::boss_thorim_gauntlet_npcsAI::UpdateAI(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::UpdateAI(), PetAI::UpdateAI(), and Player::UpdateCharmedAI().

◆ GetPowerPct()

float Unit::GetPowerPct ( Powers  power) const
inline
1451{ return GetMaxPower(power) ? 100.f * GetPower(power) / GetMaxPower(power) : 0.0f; }
uint32 GetMaxPower(Powers power) const
Definition: Unit.h:1462
uint32 GetPower(Powers power) const
Definition: Unit.h:1461

References GetMaxPower(), and GetPower().

Referenced by npc_obsidian_destroyer::EnterCombat(), npc_obsidian_eradicator::EnterCombat(), npc_obsidian_nullifier::EnterCombat(), SmartScript::ProcessAction(), SmartScript::ProcessEvent(), boss_curator::boss_curatorAI::UpdateAI(), and boss_hazzarah::UpdateAI().

◆ getPowerType()

Powers Unit::getPowerType ( ) const
inline
1459{ return Powers(GetByteValue(UNIT_FIELD_BYTES_0, 3)); }
Powers
Definition: SharedDefines.h:240

References Object::GetByteValue(), and UNIT_FIELD_BYTES_0.

Referenced by Player::ActivateSpec(), WorldSession::BuildPartyMemberStatsChangedPacket(), Spell::CheckCast(), spell_pal_blessing_of_sanctuary::CheckProc(), Player::Create(), DealDamage(), Spell::EffectEnergize(), Spell::EffectEnergizePct(), Spell::EffectPowerBurn(), Spell::EffectPowerDrain(), Spell::EffectSummonPet(), spell_chain_burn::FilterTargets(), spell_moam_mana_drain_filter::FilterTargets(), AuraEffect::HandleAuraModShapeshift(), Aura::HandleAuraSpecificMods(), HandleDummyAuraProc(), AuraEffect::HandleObsModPowerAuraTick(), HandleOverrideClassScriptAuraProc(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), spell_gen_pet_summoned::HandleScript(), Player::InitDataForForm(), ManaVoidSelector::operator()(), PowerUsersSelector::operator()(), spell_item_oracle_ablutions::PrepareSpellScript(), Player::ResetAllPowers(), boss_faction_championsAI::SelectEnemyCaster(), setDeathState(), SetMaxPower(), SetPower(), Pet::Update(), Creature::Update(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_hazzarah::UpdateAI(), boss_marli::UpdateAI(), boss_faction_championsAI::UpdateAI(), npc_nether_drake::npc_nether_drakeAI::UpdateAI(), and lfg::LFGMgr::UpdateRaidBrowser().

◆ GetPowerTypeByAuraGroup()

Powers Unit::GetPowerTypeByAuraGroup ( UnitMods  unitMod) const
15294{
15295 switch (unitMod)
15296 {
15297 case UNIT_MOD_RAGE:
15298 return POWER_RAGE;
15299 case UNIT_MOD_FOCUS:
15300 return POWER_FOCUS;
15301 case UNIT_MOD_ENERGY:
15302 return POWER_ENERGY;
15303 case UNIT_MOD_HAPPINESS:
15304 return POWER_HAPPINESS;
15305 case UNIT_MOD_RUNE:
15306 return POWER_RUNE;
15308 return POWER_RUNIC_POWER;
15309 default:
15310 case UNIT_MOD_MANA:
15311 return POWER_MANA;
15312 }
15313}
@ UNIT_MOD_RUNE
Definition: Unit.h:273
@ UNIT_MOD_ENERGY
Definition: Unit.h:271
@ UNIT_MOD_FOCUS
Definition: Unit.h:270
@ UNIT_MOD_HAPPINESS
Definition: Unit.h:272
@ UNIT_MOD_MANA
Definition: Unit.h:268
@ UNIT_MOD_RAGE
Definition: Unit.h:269
@ UNIT_MOD_RUNIC_POWER
Definition: Unit.h:274

References POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_MANA, POWER_RAGE, POWER_RUNE, POWER_RUNIC_POWER, UNIT_MOD_ENERGY, UNIT_MOD_FOCUS, UNIT_MOD_HAPPINESS, UNIT_MOD_MANA, UNIT_MOD_RAGE, UNIT_MOD_RUNE, and UNIT_MOD_RUNIC_POWER.

Referenced by HandleStatModifier().

◆ GetPPMProcChance()

float Unit::GetPPMProcChance ( uint32  WeaponSpeed,
float  PPM,
SpellInfo const *  spellProto 
) const
13368{
13369 // proc per minute chance calculation
13370 if (PPM <= 0)
13371 return 0.0f;
13372
13373 // Apply chance modifer aura
13374 if (spellProto)
13375 if (Player* modOwner = GetSpellModOwner())
13376 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_PROC_PER_MINUTE, PPM);
13377
13378 return floor((WeaponSpeed * PPM) / 600.0f); // result is chance in percents (probability = Speed_in_sec * (PPM / 60))
13379}
@ SPELLMOD_PROC_PER_MINUTE
Definition: SpellDefines.h:103

References GetSpellModOwner(), SpellInfo::Id, and SPELLMOD_PROC_PER_MINUTE.

Referenced by Player::CastItemCombatSpell(), and IsTriggeredAtSpellProcEvent().

◆ GetProcAurasTriggeredOnEvent()

void Unit::GetProcAurasTriggeredOnEvent ( std::list< AuraApplication * > &  aurasTriggeringProc,
std::list< AuraApplication * > *  procAuras,
ProcEventInfo  eventInfo 
)
16662{
16663 // use provided list of auras which can proc
16664 if (procAuras)
16665 {
16666 for (std::list<AuraApplication*>::iterator itr = procAuras->begin(); itr != procAuras->end(); ++itr)
16667 {
16668 ASSERT((*itr)->GetTarget() == this);
16669 if (!(*itr)->GetRemoveMode())
16670 if ((*itr)->GetBase()->IsProcTriggeredOnEvent(*itr, eventInfo))
16671 {
16672 (*itr)->GetBase()->PrepareProcToTrigger(*itr, eventInfo);
16673 aurasTriggeringProc.push_back(*itr);
16674 }
16675 }
16676 }
16677 // or generate one on our own
16678 else
16679 {
16680 for (AuraApplicationMap::iterator itr = GetAppliedAuras().begin(); itr != GetAppliedAuras().end(); ++itr)
16681 {
16682 if (itr->second->GetBase()->IsProcTriggeredOnEvent(itr->second, eventInfo))
16683 {
16684 itr->second->GetBase()->PrepareProcToTrigger(itr->second, eventInfo);
16685 aurasTriggeringProc.push_back(itr->second);
16686 }
16687 }
16688 }
16689}

References ASSERT, and GetAppliedAuras().

Referenced by TriggerAurasProcOnEvent().

◆ getRace()

uint8 Unit::getRace ( bool  original = false) const
21144{
21145 if (GetTypeId() == TYPEID_PLAYER)
21146 {
21147 if (original)
21148 return m_realRace;
21149 else
21150 return m_race;
21151 }
21152
21154}

References Object::GetByteValue(), Object::GetTypeId(), m_race, m_realRace, TYPEID_PLAYER, and UNIT_FIELD_BYTES_0.

Referenced by Player::_LoadHomeBind(), Player::_LoadSkills(), Player::_SaveCharacter(), Player::BuildPlayerRepop(), Corpse::BuildValuesUpdate(), Player::CreateCorpse(), GetModelForForm(), GetModelForTotem(), getRaceMask(), GetReactionTo(), Player::GetStartPosition(), Player::GetTeamId(), Player::GiveLevel(), WorldSession::HandleAlterAppearance(), AuraEffect::HandleAuraTransform(), WorldSession::HandleMirrorImageDataRequest(), modify_commandscript::HandleModifyGenderCommand(), misc_commandscript::HandlePInfoCommand(), WorldSession::HandlePlayerLoginFromDB(), reset_commandscript::HandleResetStatsOrLevelHelper(), Player::InitDisplayIds(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), Player::InitTaxiNodesForLevel(), Creature::IsValidTrainerForPlayer(), Channel::KickOrBan(), Player::LearnCustomSpells(), Player::LearnDefaultSkill(), Player::LearnDefaultSkills(), Player::LoadFromDB(), AchievementCriteriaData::Meets(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::OnPlayerEnter(), RestoreFaction(), Player::RewardHonor(), WorldSession::SendNameQueryOpcode(), Player::SetGameMaster(), Player::StoreNewItemInBestSlots(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), lfg::LFGMgr::UpdateRaidBrowser(), and Player::UpdateSkillsForLevel().

◆ getRaceMask()

◆ GetRandomContactPoint()

bool Unit::GetRandomContactPoint ( Unit const *  target,
float &  x,
float &  y,
float &  z,
bool  force = false 
) const
720{
721 float combat_reach = GetCombatReach();
722 if (combat_reach < 0.1f) // sometimes bugged for players
723 combat_reach = DEFAULT_COMBAT_REACH;
724
725 uint32 attacker_number = getAttackers().size();
726 if (attacker_number > 0)
727 --attacker_number;
728 Creature const* c = obj->ToCreature();
729 if (c)
730 if (c->isWorldBoss() || c->IsDungeonBoss() || (obj->IsPet() && const_cast<Unit*>(obj)->ToPet()->isControlled()))
731 attacker_number = 0; // pussywizard: pets and bosses just come to target from their angle
732
733 GetNearPoint(obj, x, y, z, isMoving() ? (obj->GetCombatReach() > 7.75f ? obj->GetCombatReach() - 7.5f : 0.25f) : obj->GetCombatReach(), 0.0f,
734 GetAngle(obj) + (attacker_number ? (static_cast<float>(M_PI / 2) - static_cast<float>(M_PI) * (float)rand_norm()) * float(attacker_number) / combat_reach * 0.3f : 0));
735
736 // pussywizard
737 if (std::fabs(this->GetPositionZ() - z) > this->GetCollisionHeight() || !IsWithinLOS(x, y, z))
738 {
739 x = this->GetPositionX();
740 y = this->GetPositionY();
741 z = this->GetPositionZ();
742 obj->UpdateAllowedPositionZ(x, y, z);
743 }
744 float maxDist = GetMeleeRange(obj);
745 if (GetExactDistSq(x, y, z) >= maxDist * maxDist)
746 {
747 if (force)
748 {
749 x = this->GetPositionX();
750 y = this->GetPositionY();
751 z = this->GetPositionZ();
752 return true;
753 }
754 return false;
755 }
756 return true;
757}
#define DEFAULT_COMBAT_REACH
Definition: ObjectDefines.h:46
bool IsDungeonBoss() const
Definition: Creature.cpp:3044
bool IsWithinLOS(float x, float y, float z, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS) const
Definition: Object.cpp:1326
float GetExactDistSq(float x, float y, float z) const
Definition: Position.h:170
bool isControlled() const
Definition: Pet.h:53
float GetCollisionHeight() const override
Return collision height sent to client.
Definition: Unit.cpp:21231
float GetMeleeRange(Unit const *target) const
Definition: Unit.cpp:698

References DEFAULT_COMBAT_REACH, Position::GetAngle(), getAttackers(), GetCollisionHeight(), GetCombatReach(), Position::GetExactDistSq(), GetMeleeRange(), WorldObject::GetNearPoint(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Pet::isControlled(), Creature::IsDungeonBoss(), isMoving(), IsPet(), WorldObject::IsWithinLOS(), Creature::isWorldBoss(), rand_norm(), Object::ToCreature(), ToPet(), and WorldObject::UpdateAllowedPositionZ().

Referenced by boss_bug_trio::DamageTaken(), and boss_bug_trio::DoFinalSpell().

◆ GetRangedCritChanceReduction()

float Unit::GetRangedCritChanceReduction ( ) const
inline

◆ GetRangedCritDamageReduction()

uint32 Unit::GetRangedCritDamageReduction ( uint32  damage) const
inline

◆ GetRangedDamageReduction()

uint32 Unit::GetRangedDamageReduction ( uint32  damage) const
inline

◆ GetReactionTo()

ReputationRank Unit::GetReactionTo ( Unit const *  target,
bool  checkOriginalFaction = false 
) const
10038{
10039 // always friendly to self
10040 if (this == target)
10041 return REP_FRIENDLY;
10042
10043 // always friendly to charmer or owner
10045 return REP_FRIENDLY;
10046
10047 Player const* selfPlayerOwner = GetAffectingPlayer();
10048 Player const* targetPlayerOwner = target->GetAffectingPlayer();
10049
10050 // check forced reputation to support SPELL_AURA_FORCE_REACTION
10051 if (selfPlayerOwner)
10052 {
10053 if (FactionTemplateEntry const* targetFactionTemplateEntry = target->GetFactionTemplateEntry())
10054 if (ReputationRank const* repRank = selfPlayerOwner->GetReputationMgr().GetForcedRankIfAny(targetFactionTemplateEntry))
10055 return *repRank;
10056 }
10057 else if (targetPlayerOwner)
10058 {
10059 if (FactionTemplateEntry const* selfFactionTemplateEntry = GetFactionTemplateEntry())
10060 if (ReputationRank const* repRank = targetPlayerOwner->GetReputationMgr().GetForcedRankIfAny(selfFactionTemplateEntry))
10061 return *repRank;
10062 }
10063
10065 {
10066 if (target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
10067 {
10068 if (selfPlayerOwner && targetPlayerOwner)
10069 {
10070 // always friendly to other unit controlled by player, or to the player himself
10071 if (selfPlayerOwner == targetPlayerOwner)
10072 return REP_FRIENDLY;
10073
10074 // duel - always hostile to opponent
10075 if (selfPlayerOwner->duel && selfPlayerOwner->duel->Opponent == targetPlayerOwner && selfPlayerOwner->duel->State == DUEL_STATE_IN_PROGRESS)
10076 return REP_HOSTILE;
10077
10078 // same group - checks dependant only on our faction - skip FFA_PVP for example
10079 if (selfPlayerOwner->IsInRaidWith(targetPlayerOwner))
10080 return REP_FRIENDLY; // return true to allow config option AllowTwoSide.Interaction.Group to work
10081 // however client seems to allow mixed group parties, because in 13850 client it works like:
10082 // return GetFactionReactionTo(GetFactionTemplateEntry(), target);
10083 }
10084
10085 // check FFA_PVP
10086 if (IsFFAPvP() && target->IsFFAPvP())
10087 return REP_HOSTILE;
10088
10089 if (selfPlayerOwner)
10090 {
10091 if (FactionTemplateEntry const* targetFactionTemplateEntry = target->GetFactionTemplateEntry())
10092 {
10093 if (ReputationRank const* repRank = selfPlayerOwner->GetReputationMgr().GetForcedRankIfAny(targetFactionTemplateEntry))
10094 return *repRank;
10095 if (!selfPlayerOwner->HasUnitFlag2(UNIT_FLAG2_IGNORE_REPUTATION))
10096 {
10097 if (FactionEntry const* targetFactionEntry = sFactionStore.LookupEntry(targetFactionTemplateEntry->faction))
10098 {
10099 if (targetFactionEntry->CanHaveReputation())
10100 {
10101 // check contested flags
10102 if (targetFactionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS
10103 && selfPlayerOwner->HasPlayerFlag(PLAYER_FLAGS_CONTESTED_PVP))
10104 return REP_HOSTILE;
10105
10106 // if faction has reputation, hostile state depends only from AtWar state
10107 if (selfPlayerOwner->GetReputationMgr().IsAtWar(targetFactionEntry))
10108 return REP_HOSTILE;
10109 return REP_FRIENDLY;
10110 }
10111 }
10112 }
10113 }
10114 }
10115 }
10116 }
10117
10118 ReputationRank repRank = REP_HATED;
10119 if (!sScriptMgr->IfNormalReaction(this, target, repRank))
10120 {
10121 return ReputationRank(repRank);
10122 }
10123
10124 FactionTemplateEntry const* factionTemplateEntry = nullptr;
10125 if (checkOriginalFaction)
10126 {
10127 if (GetTypeId() == TYPEID_PLAYER)
10128 {
10129 if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(getRace()))
10130 {
10131 factionTemplateEntry = sFactionTemplateStore.LookupEntry(rEntry->FactionID);
10132 }
10133 }
10134 else
10135 {
10136 Unit* owner = GetOwner();
10137 if (HasUnitTypeMask(UNIT_MASK_MINION) && owner)
10138 {
10139 factionTemplateEntry = sFactionTemplateStore.LookupEntry(owner->GetFaction());
10140 }
10141 else if (CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate())
10142 {
10143 factionTemplateEntry = sFactionTemplateStore.LookupEntry(cinfo->faction);
10144 }
10145 }
10146 }
10147
10148 if (!factionTemplateEntry)
10149 {
10150 factionTemplateEntry = GetFactionTemplateEntry();
10151 }
10152
10153 // do checks dependant only on our faction
10154 return GetFactionReactionTo(factionTemplateEntry, target);
10155}
DBCStorage< ChrRacesEntry > sChrRacesStore(ChrRacesEntryfmt)
@ REP_HATED
Definition: SharedDefines.h:152
bool HasPlayerFlag(PlayerFlags flags) const
Definition: Player.h:1090
ReputationRank GetFactionReactionTo(FactionTemplateEntry const *factionTemplateEntry, Unit const *target) const
Definition: Unit.cpp:10157
bool IsAtWar(uint32 faction_id) const
Definition: ReputationMgr.cpp:55
Definition: DBCStructure.h:679

References Player::duel, DUEL_STATE_IN_PROGRESS, FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS, GetAffectingPlayer(), GetCharmerOrOwnerOrSelf(), GetFaction(), GetFactionReactionTo(), GetFactionTemplateEntry(), ReputationMgr::GetForcedRankIfAny(), GetOwner(), getRace(), Player::GetReputationMgr(), Object::GetTypeId(), Player::HasPlayerFlag(), HasUnitFlag(), HasUnitFlag2(), HasUnitTypeMask(), ReputationMgr::IsAtWar(), IsFFAPvP(), IsInRaidWith(), PLAYER_FLAGS_CONTESTED_PVP, REP_FRIENDLY, REP_HATED, REP_HOSTILE, sChrRacesStore, sFactionStore, sFactionTemplateStore, sScriptMgr, Object::ToCreature(), TYPEID_PLAYER, UNIT_FLAG2_IGNORE_REPUTATION, UNIT_FLAG_PLAYER_CONTROLLED, and UNIT_MASK_MINION.

Referenced by _IsValidAssistTarget(), _IsValidAttackTarget(), GetDispellableAuraList(), Player::GetNPCIfCanInteractWith(), IsFriendlyTo(), IsHostileTo(), and Condition::Meets().

◆ GetRedirectThreatPercent()

uint32 Unit::GetRedirectThreatPercent ( )
inline
uint32 GetThreatPct() const
Definition: Unit.h:954

References _redirectThreatInfo, and RedirectThreatInfo::GetThreatPct().

Referenced by ThreatMgr::DoAddThreat().

◆ GetRedirectThreatTarget()

◆ GetResistance() [1/2]

uint32 Unit::GetResistance ( SpellSchoolMask  mask) const
20445{
20446 int32 resist = -1;
20447 for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
20448 if (mask & (1 << i) && (resist < 0 || resist > int32(GetResistance(SpellSchools(i)))))
20449 resist = int32(GetResistance(SpellSchools(i)));
20450
20451 // resist value will never be negative here
20452 return uint32(resist);
20453}

References GetResistance(), MAX_SPELL_SCHOOL, and SPELL_SCHOOL_NORMAL.

◆ GetResistance() [2/2]

uint32 Unit::GetResistance ( SpellSchools  school) const
inline
1435{ return GetUInt32Value(static_cast<uint16>(UNIT_FIELD_RESISTANCES) + school); }
@ UNIT_FIELD_RESISTANCES
Definition: UpdateFields.h:156

References Object::GetUInt32Value(), and UNIT_FIELD_RESISTANCES.

Referenced by Player::_SaveStats(), GetArmor(), GetEffectiveResistChance(), GetResistance(), and Player::outDebugValues().

◆ GetResistanceBuffMods()

float Unit::GetResistanceBuffMods ( SpellSchools  school,
bool  positive 
) const
inline

◆ GetShapeshiftForm()

◆ GetSharedVisionList()

◆ GetSheath()

SheathState Unit::GetSheath ( ) const
inline
SheathState
Definition: Unit.h:125

References Object::GetByteValue(), and UNIT_FIELD_BYTES_2.

◆ GetShieldBlockValue() [1/2]

virtual uint32 Unit::GetShieldBlockValue ( ) const
pure virtual

◆ GetShieldBlockValue() [2/2]

uint32 Unit::GetShieldBlockValue ( uint32  soft_cap,
uint32  hard_cap 
) const
inline
1623 {
1624 uint32 value = GetShieldBlockValue();
1625 if (value >= hard_cap)
1626 {
1627 value = (soft_cap + hard_cap) / 2;
1628 }
1629 else if (value > soft_cap)
1630 {
1631 value = soft_cap + ((value - soft_cap) / 2);
1632 }
1633
1634 return value;
1635 }

References GetShieldBlockValue().

◆ GetSingleCastAuras() [1/2]

AuraList & Unit::GetSingleCastAuras ( )
inline

◆ GetSingleCastAuras() [2/2]

AuraList const & Unit::GetSingleCastAuras ( ) const
inline
1969{ return m_scAuras; }

References m_scAuras.

◆ GetSpeed()

◆ GetSpeedRate()

◆ GetSpellCritChanceReduction()

float Unit::GetSpellCritChanceReduction ( ) const
inline

◆ GetSpellCritDamageReduction()

◆ GetSpellDamageReduction()

uint32 Unit::GetSpellDamageReduction ( uint32  damage) const
inline

◆ GetSpellMaxRangeForTarget()

float Unit::GetSpellMaxRangeForTarget ( Unit const *  target,
SpellInfo const *  spellInfo 
) const
15035{
15036 if (!spellInfo->RangeEntry)
15037 {
15038 return 0;
15039 }
15040
15041 if (spellInfo->RangeEntry->RangeMax[1] == spellInfo->RangeEntry->RangeMax[0])
15042 {
15043 return spellInfo->GetMaxRange();
15044 }
15045
15046 if (!target)
15047 {
15048 return spellInfo->GetMaxRange(true);
15049 }
15050
15051 return spellInfo->GetMaxRange(!IsHostileTo(target));
15052}

References SpellInfo::GetMaxRange(), IsHostileTo(), SpellInfo::RangeEntry, and SpellRangeEntry::RangeMax.

Referenced by spell_sha_fire_nova::CheckFireTotem(), Spell::CheckRange(), SpellTargetSelector::operator()(), ScriptedAI::SelectSpell(), GameObject::TriggeringLinkedGameObject(), and Pet::Update().

◆ GetSpellMinRangeForTarget()

float Unit::GetSpellMinRangeForTarget ( Unit const *  target,
SpellInfo const *  spellInfo 
) const
15055{
15056 if (!spellInfo->RangeEntry)
15057 {
15058 return 0;
15059 }
15060
15061 if (spellInfo->RangeEntry->RangeMin[1] == spellInfo->RangeEntry->RangeMin[0])
15062 {
15063 return spellInfo->GetMinRange();
15064 }
15065
15066 return spellInfo->GetMinRange(!IsHostileTo(target));
15067}

References SpellInfo::GetMinRange(), IsHostileTo(), SpellInfo::RangeEntry, and SpellRangeEntry::RangeMin.

Referenced by Spell::CheckRange(), SpellTargetSelector::operator()(), and ScriptedAI::SelectSpell().

◆ GetSpellModOwner()

Player * Unit::GetSpellModOwner ( ) const
16726{
16727 if (Player* player = const_cast<Unit*>(this)->ToPlayer())
16728 {
16729 return player;
16730 }
16731
16732 if (Unit* owner = GetOwner())
16733 {
16734 if (Player* player = owner->ToPlayer())
16735 {
16736 return player;
16737 }
16738 }
16739
16740 // Special handling for Eye of Kilrogg
16742 {
16743 if (TempSummon const* tempSummon = ToTempSummon())
16744 {
16745 if (Unit* summoner = tempSummon->GetSummonerUnit())
16746 {
16747 return summoner->ToPlayer();
16748 }
16749 }
16750 }
16751
16752 return nullptr;
16753}
@ NPC_EYE_OF_KILROGG
Definition: PetDefines.h:101
Definition: TemporarySummon.h:40

References Object::GetEntry(), GetOwner(), NPC_EYE_OF_KILROGG, Object::ToPlayer(), and ToTempSummon().

Referenced by Spell::_cast(), Creature::AddSpellCooldown(), ApplyEffectModifiers(), CalcArmorReducedDamage(), SpellEffectInfo::CalcDamageMultiplier(), Aura::CalcDispelChance(), Aura::CalcMaxCharges(), Aura::CalcMaxDuration(), AuraEffect::CalcPeriodicCritChance(), SpellInfo::CalcPowerCost(), Aura::CalcProcChance(), SpellEffectInfo::CalcRadius(), ThreatCalcHelper::calcThreat(), spell_dru_brambles_treant::CalculateAmount(), AuraEffect::CalculatePeriodic(), CalculateSpellDamageTaken(), SpellEffectInfo::CalcValueMultiplier(), Spell::cancel(), Spell::cast(), Spell::CheckRange(), Spell::CheckRuneCost(), Spell::EffectSummonPet(), Spell::EffectSummonType(), Spell::finish(), GetEffectiveResistChance(), SpellInfo::GetMaxRange(), GetPPMProcChance(), Spell::handle_delayed(), Spell::handle_immediate(), IsAlwaysDetectableFor(), SpellInfo::IsStrongerAuraActive(), IsTriggeredAtSpellProcEvent(), MagicSpellHitResult(), MeleeDamageBonusDone(), MeleeSpellMissChance(), ModSpellCastTime(), Spell::SelectImplicitChainTargets(), Aura::SetDuration(), SpellCriticalDamageBonus(), SpellCriticalHealingBonus(), SpellDamageBonusDone(), SpellDoneCritChance(), SpellHealingBonusDone(), Spell::SummonGuardian(), Spell::TakePower(), Spell::TakeRunePower(), Spell::UpdateChanneledTargetList(), and Aura::UpdateOwner().

◆ GetSpellSchoolByAuraGroup()

SpellSchools Unit::GetSpellSchoolByAuraGroup ( UnitMods  unitMod) const
15233{
15235
15236 switch (unitMod)
15237 {
15239 school = SPELL_SCHOOL_HOLY;
15240 break;
15242 school = SPELL_SCHOOL_FIRE;
15243 break;
15245 school = SPELL_SCHOOL_NATURE;
15246 break;
15248 school = SPELL_SCHOOL_FROST;
15249 break;
15251 school = SPELL_SCHOOL_SHADOW;
15252 break;
15254 school = SPELL_SCHOOL_ARCANE;
15255 break;
15256
15257 default:
15258 break;
15259 }
15260
15261 return school;
15262}
@ UNIT_MOD_RESISTANCE_SHADOW
Definition: Unit.h:280
@ UNIT_MOD_RESISTANCE_FROST
Definition: Unit.h:279
@ UNIT_MOD_RESISTANCE_HOLY
Definition: Unit.h:276
@ UNIT_MOD_RESISTANCE_ARCANE
Definition: Unit.h:281
@ UNIT_MOD_RESISTANCE_FIRE
Definition: Unit.h:277
@ UNIT_MOD_RESISTANCE_NATURE
Definition: Unit.h:278
@ SPELL_SCHOOL_SHADOW
Definition: SharedDefines.h:260
@ SPELL_SCHOOL_NATURE
Definition: SharedDefines.h:258
@ SPELL_SCHOOL_FROST
Definition: SharedDefines.h:259
@ SPELL_SCHOOL_ARCANE
Definition: SharedDefines.h:261
@ SPELL_SCHOOL_FIRE
Definition: SharedDefines.h:257
@ SPELL_SCHOOL_HOLY
Definition: SharedDefines.h:256

References SPELL_SCHOOL_ARCANE, SPELL_SCHOOL_FIRE, SPELL_SCHOOL_FROST, SPELL_SCHOOL_HOLY, SPELL_SCHOOL_NATURE, SPELL_SCHOOL_NORMAL, SPELL_SCHOOL_SHADOW, UNIT_MOD_RESISTANCE_ARCANE, UNIT_MOD_RESISTANCE_FIRE, UNIT_MOD_RESISTANCE_FROST, UNIT_MOD_RESISTANCE_HOLY, UNIT_MOD_RESISTANCE_NATURE, and UNIT_MOD_RESISTANCE_SHADOW.

Referenced by HandleStatModifier().

◆ getStandState()

◆ GetStat()

◆ GetStatByAuraGroup()

Stats Unit::GetStatByAuraGroup ( UnitMods  unitMod) const
15265{
15266 Stats stat = STAT_STRENGTH;
15267
15268 switch (unitMod)
15269 {
15271 stat = STAT_STRENGTH;
15272 break;
15274 stat = STAT_AGILITY;
15275 break;
15277 stat = STAT_STAMINA;
15278 break;
15280 stat = STAT_INTELLECT;
15281 break;
15283 stat = STAT_SPIRIT;
15284 break;
15285
15286 default:
15287 break;
15288 }
15289
15290 return stat;
15291}
@ UNIT_MOD_STAT_INTELLECT
Definition: Unit.h:265
@ UNIT_MOD_STAT_SPIRIT
Definition: Unit.h:266
@ UNIT_MOD_STAT_STRENGTH
Definition: Unit.h:262
@ UNIT_MOD_STAT_AGILITY
Definition: Unit.h:263
@ UNIT_MOD_STAT_STAMINA
Definition: Unit.h:264
Stats
Definition: SharedDefines.h:229
@ STAT_SPIRIT
Definition: SharedDefines.h:234
@ STAT_INTELLECT
Definition: SharedDefines.h:233
@ STAT_AGILITY
Definition: SharedDefines.h:231
@ STAT_STRENGTH
Definition: SharedDefines.h:230
@ STAT_STAMINA
Definition: SharedDefines.h:232

References STAT_AGILITY, STAT_INTELLECT, STAT_SPIRIT, STAT_STAMINA, STAT_STRENGTH, UNIT_MOD_STAT_AGILITY, UNIT_MOD_STAT_INTELLECT, UNIT_MOD_STAT_SPIRIT, UNIT_MOD_STAT_STAMINA, and UNIT_MOD_STAT_STRENGTH.

Referenced by HandleStatModifier().

◆ GetTarget()

◆ GetThreatMgr() [1/2]

ThreatMgr & Unit::GetThreatMgr ( )
inline
2145{ return m_ThreatMgr; }

References m_ThreatMgr.

Referenced by CreatureAI::_EnterEvadeMode(), npc_vengeful_shade::npc_vengeful_shadeAI::AttackStart(), boss_razorgore::boss_razorgoreAI::CanAIAttack(), boss_hazzarah::CanAIAttack(), boss_jindo::CanAIAttack(), boss_renataki::boss_renatakiAI::CanAIAttack(), boss_archimonde::boss_archimondeAI::CanUseFingerOfDeath(), boss_mor_grayhoof::CastRandomSpell(), CleanupBeforeRemoveFromMap(), boss_kiljaeden::boss_kiljaedenAI::DamageTaken(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), npc_crystalline_frayer::npc_crystalline_frayerAI::DamageTaken(), boss_ysondre::boss_ysondreAI::DamageTaken(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), npc_dark_nucleus::npc_dark_nucleusAI::DamageTaken(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::DamageTaken(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), UnitAI::DoAddAuraToAllHostilePlayers(), ScriptedAI::DoAddThreat(), boss_archimonde::boss_archimondeAI::DoCastProtection(), UnitAI::DoCastToAllHostilePlayers(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), ScriptedAI::DoGetThreat(), ScriptedAI::DoModifyThreatByPercent(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), ScriptedAI::DoResetThreat(), ScriptedAI::DoResetThreatList(), Spell::EffectModifyThreatPercent(), Spell::EffectTaunt(), boss_faction_championsAI::EnemiesInRange(), boss_malchezaar::boss_malchezaarAI::EnfeebleHealthEffect(), boss_ragnaros::boss_ragnarosAI::EnterEvadeMode(), npc_tirion_fordring_tft::npc_tirion_fordringAI::EnterEvadeMode(), GuardAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::EnterEvadeMode(), npc_varian_wrynn::npc_varian_wrynnAI::EnterEvadeMode(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), boss_ouro::EnterEvadeMode(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), npc_terenas_menethil::npc_terenas_menethilAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), npc_escortAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), hyjalAI::EnterEvadeMode(), TemporaryThreatModifierEvent::Execute(), StartMovementEvent::Execute(), boss_supremus::boss_supremusAI::FindHatefulStrikeTarget(), boss_shade_of_aran::boss_aranAI::FlameWreathEffect(), SmartScript::GetTargets(), UnitAI::GetThreatMgr(), debug_commandscript::HandleDebugThreatListCommand(), spell_karazhan_blink::spell_karazhan_blink_SpellScript::HandleDummy(), spell_q11919_q11940_drake_hunt::spell_q11919_q11940_drake_hunt_AuraScript::HandleEffectRemove(), spell_enveloping_webs::HandleOnHit(), spell_arcane_vacuum::HandleOnHit(), HandleProcTriggerSpell(), PetAI::HandleReturnMovement(), spell_pursue::spell_pursue_SpellScript::HandleScript(), spell_gurtogg_eject::spell_gurtogg_eject_SpellScript::HandleScriptEffect(), spell_leotheras_whirlwind::spell_leotheras_whirlwind_SpellScript::HandleScriptEffect(), boss_jindo::JustSummoned(), Kill(), boss_urom::boss_uromAI::LeaveCombat(), Creature::ModifyThreatPercentTemp(), boss_bug_trio::MovementInform(), npc_pet_mage_mirror_image::MySelectNextTarget(), spell_halion_twilight_phasing::spell_halion_twilight_phasing_AuraScript::OnApply(), spell_halion_twilight_phasing::spell_halion_twilight_phasing_AuraScript::OnRemove(), NonTankTargetSelector::operator()(), StoneGripTargetSelector::operator()(), SmartScript::ProcessAction(), boss_priestess_lackey_commonAI::RecalculateThreat(), boss_faction_championsAI::RecalculateThreat(), boss_faction_championsAI::SelectEnemyCaster(), npc_scholomance_occultist::npc_scholomance_occultistAI::SelectUnitCasting(), SendChangeCurrentVictimOpcode(), SendThreatListUpdate(), setDeathState(), SetPhaseMask(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::SpellHit(), npc_yenniku::npc_yennikuAI::SpellHit(), npc_enslaved_netherwing_drake::npc_enslaved_netherwing_drakeAI::SpellHit(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::SpellHitTarget(), boss_ouro::SpellHitTarget(), spell_putricide_ooze_channel::spell_putricide_ooze_channel_SpellScript::StartAttack(), BossAI::TeleportCheaters(), Creature::Update(), Update(), boss_drakkisath::boss_drakkisathAI::UpdateAI(), boss_nefarian::UpdateAI(), boss_yazzai::boss_yazzaiAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_yenniku::npc_yennikuAI::UpdateAI(), boss_grilek::boss_grilekAI::UpdateAI(), boss_hakkar::boss_hakkarAI::UpdateAI(), boss_jindo::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), boss_sartura::UpdateAI(), npc_sartura_royal_guard::UpdateAI(), boss_taldaram::UpdateAI(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), boss_eck::boss_eckAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_frozen_orb::npc_frozen_orbAI::UpdateAI(), boss_blackheart_the_inciter::boss_blackheart_the_inciterAI::UpdateAI(), boss_murmur::boss_murmurAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_the_lurker_below::boss_the_lurker_belowAI::UpdateAI(), boss_alar::boss_alarAI::UpdateAI(), npc_aeranas::npc_aeranasAI::UpdateAI(), npc_phase_hunter::npc_phase_hunterAI::UpdateAI(), boss_netherspite::boss_netherspiteAI::UpdatePortals(), and CreatureAI::UpdateVictim().

◆ GetThreatMgr() [2/2]

ThreatMgr const & Unit::GetThreatMgr ( ) const
inline
2146{ return m_ThreatMgr; }

References m_ThreatMgr.

◆ GetTotalAttackPowerValue()

float Unit::GetTotalAttackPowerValue ( WeaponAttackType  attType,
Unit pVictim = nullptr 
) const
15316{
15317 if (attType == RANGED_ATTACK)
15318 {
15320 if( victim )
15321 ap += victim->GetTotalAuraModifier(SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS);
15322
15323 if (ap < 0)
15324 return 0.0f;
15326 }
15327 else
15328 {
15330 if( victim )
15331 ap += victim->GetTotalAuraModifier(SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS);
15332
15333 if (ap < 0)
15334 return 0.0f;
15336 }
15337}
@ UNIT_FIELD_ATTACK_POWER_MODS
Definition: UpdateFields.h:163
@ UNIT_FIELD_RANGED_ATTACK_POWER
Definition: UpdateFields.h:165
@ UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER
Definition: UpdateFields.h:167
@ UNIT_FIELD_ATTACK_POWER_MULTIPLIER
Definition: UpdateFields.h:164
@ UNIT_FIELD_ATTACK_POWER
Definition: UpdateFields.h:162
@ UNIT_FIELD_RANGED_ATTACK_POWER_MODS
Definition: UpdateFields.h:166
@ SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS
Definition: SpellAuraDefines.h:190
@ SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS
Definition: SpellAuraDefines.h:228
int32 GetInt32Value(uint16 index) const
Definition: Object.cpp:299

References Object::GetFloatValue(), Object::GetInt32Value(), GetTotalAuraModifier(), RANGED_ATTACK, SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS, SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS, UNIT_FIELD_ATTACK_POWER, UNIT_FIELD_ATTACK_POWER_MODS, UNIT_FIELD_ATTACK_POWER_MULTIPLIER, UNIT_FIELD_RANGED_ATTACK_POWER, UNIT_FIELD_RANGED_ATTACK_POWER_MODS, and UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER.

Referenced by Creature::CalculateMinMaxDamage(), Player::CalculateMinMaxDamage(), Spell::EffectSchoolDMG(), Spell::EffectWeaponDmg(), spell_warr_execute::HandleEffect(), spell_pal_seal_of_righteousness::HandleProc(), HandleProcTriggerSpell(), Spell::HandleThreatSpells(), Guardian::InitStatsForLevel(), SpellBaseDamageBonusDone(), SpellBaseHealingBonusDone(), SpellDamageBonusDone(), SpellHealingBonusDone(), Guardian::UpdateDamagePhysical(), and lfg::LFGMgr::UpdateRaidBrowser().

◆ GetTotalAuraModifier()

◆ GetTotalAuraModifierAreaExclusive()

int32 Unit::GetTotalAuraModifierAreaExclusive ( AuraType  auratype) const
5803{
5804 int32 modifier = 0;
5805 int32 areaModifier = 0;
5806
5807 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5808 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5809 {
5810 if ((*i)->GetSpellInfo()->HasAreaAuraEffect())
5811 {
5812 if (areaModifier < (*i)->GetAmount())
5813 areaModifier = (*i)->GetAmount();
5814 }
5815 else
5816 modifier += (*i)->GetAmount();
5817 }
5818
5819 return modifier + areaModifier;
5820}

References GetAuraEffectsByType().

Referenced by Player::UpdateSpellCritChance().

◆ GetTotalAuraModifierByAffectMask()

int32 Unit::GetTotalAuraModifierByAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
5979{
5980 int32 modifier = 0;
5981
5982 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5983 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5984 if ((*i)->IsAffectedOnSpell(affectedSpell))
5985 modifier += (*i)->GetAmount();
5986
5987 return modifier;
5988}

References GetAuraEffectsByType().

◆ GetTotalAuraModifierByMiscMask()

int32 Unit::GetTotalAuraModifierByMiscMask ( AuraType  auratype,
uint32  misc_mask 
) const
5874{
5875 int32 modifier = 0;
5876
5877 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5878 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5879 {
5880 if ((*i)->GetMiscValue()& misc_mask)
5881 modifier += (*i)->GetAmount();
5882 }
5883 return modifier;
5884}

References GetAuraEffectsByType().

Referenced by CalcArmorReducedDamage(), CalculateMeleeDamage(), CalculateSpellDamageTaken(), GetEffectiveResistChance(), MagicSpellHitResult(), SpellCriticalDamageBonus(), SpellDamageBonusDone(), SpellDoneCritChance(), and Player::UpdateSpellCritChance().

◆ GetTotalAuraModifierByMiscValue()

int32 Unit::GetTotalAuraModifierByMiscValue ( AuraType  auratype,
int32  misc_value 
) const
5927{
5928 int32 modifier = 0;
5929
5930 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5931 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5932 if ((*i)->GetMiscValue() == misc_value)
5933 modifier += (*i)->GetAmount();
5934
5935 return modifier;
5936}

References GetAuraEffectsByType().

Referenced by Player::CalculateReputationGain(), GetMechanicResistChance(), MeleeSpellHitResult(), ModSpellDuration(), Creature::Regenerate(), Player::Regenerate(), RollMeleeOutcomeAgainst(), and Player::UpdateManaRegen().

◆ GetTotalAuraModValue()

float Unit::GetTotalAuraModValue ( UnitMods  unitMod) const
15206{
15207 if (unitMod >= UNIT_MOD_END)
15208 {
15209 LOG_ERROR("entities.unit", "attempt to access non-existing UnitMods in GetTotalAuraModValue()!");
15210 return 0.0f;
15211 }
15212
15213 if (m_auraModifiersGroup[unitMod][TOTAL_PCT] <= 0.0f)
15214 return 0.0f;
15215
15216 float value = m_auraModifiersGroup[unitMod][BASE_VALUE];
15217 value *= m_auraModifiersGroup[unitMod][BASE_PCT];
15218 value += m_auraModifiersGroup[unitMod][TOTAL_VALUE];
15219 value *= m_auraModifiersGroup[unitMod][TOTAL_PCT];
15220
15221 return value;
15222}

References BASE_PCT, BASE_VALUE, LOG_ERROR, m_auraModifiersGroup, TOTAL_PCT, TOTAL_VALUE, and UNIT_MOD_END.

Referenced by Creature::UpdateArmor(), Creature::UpdateMaxHealth(), Creature::UpdateMaxPower(), and Creature::UpdateResistances().

◆ GetTotalAuraMultiplier()

float Unit::GetTotalAuraMultiplier ( AuraType  auratype) const
5837{
5838 float multiplier = 1.0f;
5839
5840 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5841 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5842 AddPct(multiplier, (*i)->GetAmount());
5843
5844 return multiplier;
5845}

References AddPct(), and GetAuraEffectsByType().

Referenced by MeleeSpellHitResult(), RollMeleeOutcomeAgainst(), SpellCriticalHealingBonus(), and UpdateSpeed().

◆ GetTotalAuraMultiplierByAffectMask()

float Unit::GetTotalAuraMultiplierByAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
5991{
5992 float multiplier = 1.0f;
5993
5994 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5995 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5996 if ((*i)->IsAffectedOnSpell(affectedSpell))
5997 AddPct(multiplier, (*i)->GetAmount());
5998
5999 return multiplier;
6000}

References AddPct(), and GetAuraEffectsByType().

◆ GetTotalAuraMultiplierByMiscMask()

float Unit::GetTotalAuraMultiplierByMiscMask ( AuraType  auratype,
uint32  misc_mask 
) const
5887{
5888 float multiplier = 1.0f;
5889
5890 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5891 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5892 if (((*i)->GetMiscValue() & misc_mask))
5893 AddPct(multiplier, (*i)->GetAmount());
5894
5895 return multiplier;
5896}

References AddPct(), and GetAuraEffectsByType().

Referenced by CalculateAOEDamageReduction(), CalculateMeleeDamage(), MeleeDamageBonusTaken(), and SpellCriticalHealingBonus().

◆ GetTotalAuraMultiplierByMiscValue()

float Unit::GetTotalAuraMultiplierByMiscValue ( AuraType  auratype,
int32  misc_value 
) const
5939{
5940 float multiplier = 1.0f;
5941
5942 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5943 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5944 if ((*i)->GetMiscValue() == misc_value)
5945 AddPct(multiplier, (*i)->GetAmount());
5946
5947 return multiplier;
5948}

References AddPct(), and GetAuraEffectsByType().

Referenced by Player::UpdateManaRegen().

◆ GetTotalStatValue()

float Unit::GetTotalStatValue ( Stats  stat,
float  additionalValue = 0.0f 
) const
15190{
15191 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_STAT_START) + stat);
15192
15193 if (m_auraModifiersGroup[unitMod][TOTAL_PCT] <= 0.0f)
15194 return 0.0f;
15195
15196 // value = ((base_value * base_pct) + total_value) * total_pct
15197 float value = m_auraModifiersGroup[unitMod][BASE_VALUE] + GetCreateStat(stat);
15198 value *= m_auraModifiersGroup[unitMod][BASE_PCT];
15199 value += m_auraModifiersGroup[unitMod][TOTAL_VALUE] + additionalValue;
15200 value *= m_auraModifiersGroup[unitMod][TOTAL_PCT];
15201
15202 return value;
15203}
UnitMods
Definition: Unit.h:261
@ UNIT_MOD_STAT_START
Definition: Unit.h:289
float GetCreateStat(Stats stat) const
Definition: Unit.h:2045

References BASE_PCT, BASE_VALUE, GetCreateStat(), m_auraModifiersGroup, TOTAL_PCT, TOTAL_VALUE, and UNIT_MOD_STAT_START.

Referenced by Player::UpdateAllStats(), Guardian::UpdateStats(), and Player::UpdateStats().

◆ getTransForm()

◆ GetTransGUID()

◆ GetUnitBlockChance()

float Unit::GetUnitBlockChance ( ) const
3656{
3657 if (Player const* player = ToPlayer())
3658 {
3659 if (player->CanBlock())
3660 {
3661 Item* tmpitem = player->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
3662 if (tmpitem && !tmpitem->IsBroken() && tmpitem->GetTemplate()->Block)
3664 }
3665 // is player but has no block ability or no not broken shield equipped
3666 return 0.0f;
3667 }
3668 else
3669 {
3670 if (ToCreature()->IsTotem())
3671 return 0.0f;
3672 else
3673 {
3674 float block = 5.0f;
3676 return block > 0.0f ? block : 0.0f;
3677 }
3678 }
3679}
@ PLAYER_BLOCK_PERCENTAGE
Definition: UpdateFields.h:346
@ EQUIPMENT_SLOT_OFFHAND
Definition: Player.h:692
#define INVENTORY_SLOT_BAG_0
Definition: Player.h:671
@ SPELL_AURA_MOD_BLOCK_PERCENT
Definition: SpellAuraDefines.h:114
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:546
bool IsBroken() const
Definition: Item.h:251
uint32 Block
Definition: ItemTemplate.h:683

References ItemTemplate::Block, EQUIPMENT_SLOT_OFFHAND, Object::GetFloatValue(), Item::GetTemplate(), GetTotalAuraModifier(), INVENTORY_SLOT_BAG_0, Item::IsBroken(), IsTotem(), PLAYER_BLOCK_PERCENTAGE, SPELL_AURA_MOD_BLOCK_PERCENT, Object::ToCreature(), and Object::ToPlayer().

Referenced by isSpellBlocked(), MeleeSpellHitResult(), and RollMeleeOutcomeAgainst().

◆ GetUnitCriticalChance()

float Unit::GetUnitCriticalChance ( WeaponAttackType  attackType,
Unit const *  victim 
) const
3682{
3683 float crit;
3684
3685 if (GetTypeId() == TYPEID_PLAYER)
3686 {
3687 switch (attackType)
3688 {
3689 case BASE_ATTACK:
3691 break;
3692 case OFF_ATTACK:
3694 break;
3695 case RANGED_ATTACK:
3697 break;
3698 // Just for good manner
3699 default:
3700 crit = 0.0f;
3701 break;
3702 }
3703 }
3704 else
3705 {
3706 crit = 5.0f;
3709 }
3710
3711 // flat aura mods
3712 if (attackType == RANGED_ATTACK)
3713 crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE);
3714 else
3715 crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE);
3716
3717 AuraEffectList const& mTotalAuraList = victim->GetAuraEffectsByType(SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER);
3718 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
3719 {
3720 if (GetGUID() != (*i)->GetCasterGUID())
3721 continue;
3722
3723 crit += (*i)->GetAmount();
3724 }
3725
3726 // reduce crit chance from Rating for players
3727 if (attackType != RANGED_ATTACK)
3728 Unit::ApplyResilience(victim, &crit, nullptr, false, CR_CRIT_TAKEN_MELEE);
3729 else
3730 Unit::ApplyResilience(victim, &crit, nullptr, false, CR_CRIT_TAKEN_RANGED);
3731
3732 // Apply crit chance from defence skill
3733 crit += (int32(GetMaxSkillValueForLevel(victim)) - int32(victim->GetDefenseSkillValue(this))) * 0.04f;
3734
3735 // xinef: SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE should be calculated at the end
3736 crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE);
3737
3738 if (crit < 0.0f)
3739 crit = 0.0f;
3740 return crit;
3741}
@ PLAYER_RANGED_CRIT_PERCENTAGE
Definition: UpdateFields.h:352
@ PLAYER_CRIT_PERCENTAGE
Definition: UpdateFields.h:351
@ PLAYER_OFFHAND_CRIT_PERCENTAGE
Definition: UpdateFields.h:353
@ SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER
Definition: SpellAuraDefines.h:371
@ SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE
Definition: SpellAuraDefines.h:251
@ SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE
Definition: SpellAuraDefines.h:260
@ SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE
Definition: SpellAuraDefines.h:250
@ SPELL_AURA_MOD_CRIT_PCT
Definition: SpellAuraDefines.h:353
@ SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
Definition: SpellAuraDefines.h:115
uint16 GetMaxSkillValueForLevel(Unit const *target=nullptr) const
Definition: Unit.h:1547

References ApplyResilience(), BASE_ATTACK, CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, GetAuraEffectsByType(), GetDefenseSkillValue(), Object::GetFloatValue(), Object::GetGUID(), GetMaxSkillValueForLevel(), GetTotalAuraModifier(), Object::GetTypeId(), OFF_ATTACK, PLAYER_CRIT_PERCENTAGE, PLAYER_OFFHAND_CRIT_PERCENTAGE, PLAYER_RANGED_CRIT_PERCENTAGE, RANGED_ATTACK, SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE, SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER, SPELL_AURA_MOD_CRIT_PCT, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT, and TYPEID_PLAYER.

Referenced by spell_dk_wandering_plague_aura::CheckProc(), and RollMeleeOutcomeAgainst().

◆ GetUnitDodgeChance()

float Unit::GetUnitDodgeChance ( ) const
3594{
3595 if (GetTypeId() == TYPEID_PLAYER)
3596 return ToPlayer()->GetRealDodge(); //GetFloatValue(PLAYER_DODGE_PERCENTAGE);
3597 else
3598 {
3599 if (ToCreature()->IsTotem())
3600 return 0.0f;
3601 else
3602 {
3603 float dodge = ToCreature()->isWorldBoss() ? 5.85f : 5.0f; // Xinef: bosses should have 6.5% dodge (5.9 + 0.6 from defense skill difference)
3605 return dodge > 0.0f ? dodge : 0.0f;
3606 }
3607 }
3608}
@ SPELL_AURA_MOD_DODGE_PERCENT
Definition: SpellAuraDefines.h:112
float GetRealDodge() const
Definition: Player.h:2555

References Player::GetRealDodge(), GetTotalAuraModifier(), Object::GetTypeId(), IsTotem(), Creature::isWorldBoss(), SPELL_AURA_MOD_DODGE_PERCENT, Object::ToCreature(), Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by MeleeSpellHitResult(), and RollMeleeOutcomeAgainst().

◆ GetUnitFlags()

◆ GetUnitFlags2()

UnitFlags2 Unit::GetUnitFlags2 ( ) const
inline
@ UNIT_FIELD_FLAGS_2
Definition: UpdateFields.h:118
UnitFlags2
Definition: Unit.h:486

References Object::GetUInt32Value(), and UNIT_FIELD_FLAGS_2.

Referenced by npc_commandscript::HandleNpcInfoCommand().

◆ GetUnitMeleeSkill()

uint32 Unit::GetUnitMeleeSkill ( Unit const *  target = nullptr) const
inline
1636{ return (target ? getLevelForTarget(target) : GetLevel()) * 5; }

References GetLevel(), and getLevelForTarget().

Referenced by DealMeleeDamage(), GetDefenseSkillValue(), and GetWeaponSkillValue().

◆ GetUnitMissChance()

float Unit::GetUnitMissChance ( WeaponAttackType  attType) const
3641{
3642 float miss_chance = 5.00f;
3643
3644 if (Player const* player = ToPlayer())
3645 miss_chance += player->GetMissPercentageFromDefence();
3646
3647 if (attType == RANGED_ATTACK)
3649 else
3651
3652 return miss_chance;
3653}
@ SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE
Definition: SpellAuraDefines.h:247
@ SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE
Definition: SpellAuraDefines.h:248

References GetTotalAuraModifier(), RANGED_ATTACK, SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE, SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE, and Object::ToPlayer().

Referenced by MeleeSpellMissChance().

◆ GetUnitMovementFlags()

◆ GetUnitParryChance()

float Unit::GetUnitParryChance ( ) const
3611{
3612 float chance = 0.0f;
3613
3614 if (Player const* player = ToPlayer())
3615 {
3616 if (player->CanParry())
3617 {
3618 Item* tmpitem = player->GetWeaponForAttack(BASE_ATTACK, true);
3619 if (!tmpitem)
3620 tmpitem = player->GetWeaponForAttack(OFF_ATTACK, true);
3621
3622 if (tmpitem)
3623 chance = player->GetRealParry(); //GetFloatValue(PLAYER_PARRY_PERCENTAGE);
3624 }
3625 }
3626 else if (GetTypeId() == TYPEID_UNIT)
3627 {
3628 if (ToCreature()->isWorldBoss())
3629 chance = 13.4f; // + 0.6 by skill diff
3631 chance = 5.0f;
3632
3633 // Xinef: if aura is present, type should not matter
3635 }
3636
3637 return chance > 0.0f ? chance : 0.0f;
3638}
@ SPELL_AURA_MOD_PARRY_PERCENT
Definition: SpellAuraDefines.h:110

References BASE_ATTACK, CREATURE_TYPE_HUMANOID, GetCreatureType(), GetTotalAuraModifier(), Object::GetTypeId(), OFF_ATTACK, SPELL_AURA_MOD_PARRY_PERCENT, Object::ToCreature(), Object::ToPlayer(), and TYPEID_UNIT.

Referenced by spell_dk_spell_deflection::Absorb(), MeleeSpellHitResult(), and RollMeleeOutcomeAgainst().

◆ GetUnitState()

uint32 Unit::GetUnitState ( ) const
inline

◆ GetUnitTypeMask()

uint32 Unit::GetUnitTypeMask ( ) const
inline
1409{ return m_unitTypeMask; }

References m_unitTypeMask.

◆ GetVehicle()

Vehicle * Unit::GetVehicle ( ) const
inline
2354{ return m_vehicle; }

References m_vehicle.

Referenced by KillRewarder::_InitXP(), Vehicle::AddPassenger(), WorldSession::BuildPartyMemberStatsChangedPacket(), boss_the_lich_king::boss_the_lich_kingAI::CanAIAttack(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::CanAIAttack(), npc_raging_spirit::npc_raging_spiritAI::CanAIAttack(), npc_icc_lk_checktarget::npc_icc_lk_checktargetAI::CanAIAttack(), boss_flame_leviathan_defense_turret::boss_flame_leviathan_defense_turretAI::CanAIAttack(), instance_eye_of_eternity::instance_eye_of_eternity_InstanceMapScript::CheckAchievementCriteriaMeet(), Spell::CheckCast(), Spell::EffectJumpDest(), Spell::EffectKnockBack(), CreatureAI::EnterEvadeMode(), GetDirectTransport(), SmartScript::GetTargets(), GetTransGUID(), WorldSession::HandleAttackSwingOpcode(), WorldSession::HandleChangeSeatsOnControlledVehicle(), spell_switch_infragreen_bomber_station::spell_switch_infragreen_bomber_station_SpellScript::HandleDummy(), WorldSession::HandleMovementOpcodes(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleSpectatorSpectateCommand(), Player::IsPetNeedBeTemporaryUnsummoned(), npc_bone_spike::npc_bone_spikeAI::IsSummonedBy(), npc_nexus_lord::npc_nexus_lordAI::JustDied(), npc_scion_of_eternity::npc_scion_of_eternityAI::JustDied(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::MoveInLineOfSight(), achievement_flame_leviathan_garage::OnCheck(), achievement_wg_didnt_stand_a_chance::OnCheck(), npc_announcer_toc5::OnGossipHello(), BattlefieldWG::OnPlayerLeaveWar(), boss_flame_leviathan_overload_device::boss_flame_leviathan_overload_deviceAI::OnSpellClick(), VehicleCheck::operator()(), OutDebugInfo(), spell_fight_fire_bomber::spell_fight_fire_bomber_SpellScript::PrepareSpellScript(), Player::ProcessDelayedOperations(), Player::ProcessTerrainStatusUpdate(), Vehicle::RemovePassenger(), Creature::SelectVictim(), SetControlled(), Player::SetViewpoint(), lfg::LFGMgr::TeleportPlayer(), npc_pilgrims_bounty_chair::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), npc_impaling_spear::npc_impaling_spearAI::UpdateAI(), npc_ulduar_mimiron_rocket::npc_ulduar_mimiron_rocketAI::UpdateAI(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::UpdateAI(), Player::UpdateAreaDependentAuras(), UpdatePosition(), UpdateSpeed(), GameObject::Use(), Acore::MessageDistDeliverer::Visit(), and Acore::MessageDistDelivererToHostile::Visit().

◆ GetVehicleBase()

Unit * Unit::GetVehicleBase ( ) const
18881{
18882 return m_vehicle ? m_vehicle->GetBase() : nullptr;
18883}

References Vehicle::GetBase(), and m_vehicle.

Referenced by boss_flame_leviathan::boss_flame_leviathanAI::AttackStart(), boss_flame_leviathan_defense_turret::boss_flame_leviathan_defense_turretAI::CanAIAttack(), WorldObject::CanNeverSee(), WorldObject::CanSeeOrDetect(), instance_oculus::instance_oculus_InstanceMapScript::CheckAchievementCriteriaMeet(), npc_bone_spike::npc_bone_spikeAI::DoAction(), ExitVehicle(), GetTransGUID(), GetVehicleCreatureBase(), spell_gen_on_tournament_mount::HandleApplyEffect(), WorldSession::HandleChangeSeatsOnControlledVehicle(), spell_svalna_remove_spear::spell_svalna_remove_spear_SpellScript::HandleScript(), spell_vehicle_grab_pyrite::spell_vehicle_grab_pyrite_SpellScript::HandleScript(), npc_scarlet_miner::npc_scarlet_minerAI::InitCartQuest(), npc_xt002_heart::npc_xt002_heartAI::JustSummoned(), achievement_wg_vehicular_gnomeslaughter::OnCheck(), OutDebugInfo(), spell_charge_shield_bomber::spell_charge_shield_bomber_SpellScript::PrepareSpellScript(), Spell::SelectImplicitCasterObjectTargets(), Movement::MoveSplineInit::SetFacing(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::SpellHit(), npc_q24545_lich_king::npc_q24545_lich_kingAI::SpellHitTarget(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), npc_nexus_lord::npc_nexus_lordAI::UpdateAI(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), Player::UpdateAreaDependentAuras(), and UpdateSpeed().

◆ GetVehicleCreatureBase()

◆ GetVehicleKit()

Vehicle * Unit::GetVehicleKit ( ) const
inline
2353{ return m_vehicleKit; }

References m_vehicleKit.

Referenced by _EnterVehicle(), Creature::AddToWorld(), Creature::AIM_Initialize(), boss_xt002::boss_xt002AI::AttachHeart(), npc_salvaged_siege_engine::BeforeSpellClick(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::boss_deathbringer_saurfangAI(), Aura::CanStackWith(), spell_demolisher_ride_vehicle::spell_demolisher_ride_vehicle_SpellScript::CheckCast(), SmartAI::CheckConditions(), VehicleAI::CheckConditions(), Map::CreatureRelocation(), Dismount(), npc_orb_carrier::npc_orb_carrierAI::DoAction(), npc_ulduar_vx001::npc_ulduar_vx001AI::DoAction(), npc_hover_disk::npc_hover_diskAI::DoAction(), boss_skadi_grauf::boss_skadi_graufAI::DoAction(), Spell::EffectTeleportUnits(), boss_gormok::boss_gormokAI::EnterCombat(), CreatureAI::EnterEvadeMode(), boss_ick::boss_ickAI::GetKrick(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::GetS3(), SmartScript::GetTargets(), AuraEffect::HandleAuraControlVehicle(), AuraEffect::HandleAuraSetVehicle(), WorldSession::HandleCastSpellOpcode(), spell_q13280_13283_plant_battle_standard::HandleDummy(), WorldSession::HandleEjectPassenger(), spell_q12919_gymers_throw::HandleScript(), HandleSpellClick(), IsOnVehicle(), go_wg_vehicle_teleporter::go_wg_vehicle_teleporterAI::IsValidVehicle(), Mount(), npc_hover_disk::npc_hover_diskAI::MovementInform(), npc_enslaved_proto_drake::npc_enslaved_proto_drakeAI::MovementInform(), npc_vics_flying_machine::npc_vics_flying_machineAI::MovementInform(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::npc_high_overlord_saurfangAI(), npc_orb_carrier::npc_orb_carrierAI::npc_orb_carrierAI(), spell_systems_shutdown::spell_systems_shutdown_AuraScript::OnApply(), VehicleAI::OnCharmed(), spell_blood_queen_frenzied_bloodthirst::spell_blood_queen_frenzied_bloodthirst_AuraScript::OnRemove(), FlameLeviathanPursuedTargetSelector::operator()(), OutDebugInfo(), npc_wintergarde_gryphon::PassengerBoarded(), boss_flame_leviathan_seat::boss_flame_leviathan_seatAI::PassengerBoarded(), Map::PlayerRelocation(), SmartScript::ProcessAction(), boss_skadi_grauf::boss_skadi_graufAI::RemoveSkadi(), Spell::SelectImplicitCasterObjectTargets(), SmartAI::SmartAI(), npc_wintergarde_gryphon::SpellHit(), npc_vics_flying_machine::npc_vics_flying_machineAI::SpellHit(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::SpellHit(), npc_storm_cloud::npc_storm_cloudAI::SpellHit(), boss_flame_leviathan::boss_flame_leviathanAI::SpellHitTarget(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::SpreadFire(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), npc_vortex_ride::npc_vortex_rideAI::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), npc_preparations_for_war_vehicle::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_freed_protodrake::npc_freed_protodrakeAI::UpdateAI(), npc_wg_siege_machine::npc_wg_siege_machineAI::UpdateAI(), UpdateHeight(), and UpdateOrientation().

◆ GetVictim()

Unit * Unit::GetVictim ( ) const
inline
1386{ return m_attacking; }

References m_attacking.

Referenced by PetAI::_needToStop(), npc_escortAI::AssistPlayerInCombatAgainst(), FollowerAI::AssistPlayerInCombatAgainst(), SmartAI::AssistPlayerInCombatAgainst(), PetAI::AttackedBy(), npc_bartleby::npc_bartlebyAI::AttackedBy(), npc_calvin_montague::npc_calvin_montagueAI::AttackedBy(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::AttackedBy(), boss_malygos::boss_malygosAI::AttackStart(), npc_dark_nucleus::npc_dark_nucleusAI::AttackStart(), Object::BuildMovementUpdate(), Creature::CallAssistance(), Creature::CallForHelp(), TurretAI::CanAIAttack(), PetAI::CanAttack(), boss_archimonde::boss_archimondeAI::CanUseFingerOfDeath(), prince_axes::prince_axesAI::changetarget(), Spell::CheckCast(), boss_mandokir::boss_mandokirAI::DamageDealt(), boss_garfrost::boss_garfrostAI::DamageTaken(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), npc_dark_nucleus::npc_dark_nucleusAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), boss_skadi::boss_skadiAI::DoAction(), UnitAI::DoCast(), boss_archimonde::boss_archimondeAI::DoCastDoomfire(), UnitAI::DoCastVictim(), ConfusedMovementGenerator< T >::DoFinalize(), Creature::DoFleeToGetAssistance(), UnitAI::DoMeleeAttackIfReady(), boss_zuljin::boss_zuljinAI::DoMeleeAttackIfReady(), boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), UnitAI::DoSpellAttackIfReady(), ScriptedAI::DoStopAttack(), Spell::EffectTaunt(), boss_ouro::Emerge(), boss_romulo::boss_romuloAI::EnterCombat(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::EnterCombat(), npc_zealot_zath::npc_zealot_zathAI::EnterCombat(), boss_vem::EnterCombat(), boss_veklor::EnterCombat(), boss_halazzi::boss_halazziAI::EnterPhase(), boss_zuljin::boss_zuljinAI::EnterPhase(), RestoreAttack::Execute(), StartMovementEvent::Execute(), boss_sartharion_tenebron::boss_sartharion_tenebronAI::ExecuteEvent(), boss_sartharion_shadron::boss_sartharion_shadronAI::ExecuteEvent(), boss_sartharion_vesperon::boss_sartharion_vesperonAI::ExecuteEvent(), emerald_dragonAI::ExecuteEvent(), spell_shazzrah_gate_dummy::spell_shazzrah_gate_dummy_SpellScript::FilterTargets(), spell_chain_burn::FilterTargets(), TimedFleeingMovementGenerator::Finalize(), getAttackerForHelper(), ThreatMgr::GetCurrentVictim(), Player::GetInitialVisiblePackets(), CreatureGroup::GetNewTargetForMember(), SmartScript::GetTargets(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), cast_commandscript::HandleCastTargetCommad(), spell_aggro_drones::HandleDummy(), HandleDummyAuraProc(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), spell_lurker_below_spout::spell_lurker_below_spout_AuraScript::HandleEffectRemove(), AuraEffect::HandleModPossessPet(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), WorldSession::HandlePetActionHelper(), WorldSession::HandleSetRaidDifficultyOpcode(), ChaseMovementGenerator< T >::HasLostTarget(), Spell::InitExplicitTargets(), RotateMovementGenerator::Initialize(), IsMutualChase(), boss_ouro::IsPlayerWithinMeleeRange(), boss_ragnaros::boss_ragnarosAI::IsVictimWithinMeleeRange(), boss_halazzi::boss_halazziAI::JustSummoned(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustSummoned(), boss_anzu::boss_anzuAI::JustSummoned(), boss_the_black_stalker::JustSummoned(), boss_nethermancer_sepethrea::boss_nethermancer_sepethreaAI::JustSummoned(), npc_nelson::npc_nelsonAI::JustSummoned(), boss_nightbane::boss_nightbaneAI::JustSummoned(), npc_emily::npc_emilyAI::JustSummoned(), PetAI::KilledUnit(), boss_ick::boss_ickAI::KilledUnit(), boss_flame_leviathan::boss_flame_leviathanAI::KilledUnit(), spell_svalna_revive_champion::spell_svalna_revive_champion_SpellScript::Land(), CreatureGroup::LeaderMoveTo(), CreatureGroup::MemberEngagingTarget(), CreatureAI::MoveBackwardsChecks(), CreatureAI::MoveCircleChecks(), FollowerAI::MoveInLineOfSight(), npc_shay_leafrunner::npc_shay_leafrunnerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), alliance_rifleman::alliance_riflemanAI::MoveInLineOfSight(), npc_kerlonian::npc_kerlonianAI::MoveInLineOfSight(), npc_tooga::npc_toogaAI::MoveInLineOfSight(), npc_ringo::npc_ringoAI::MoveInLineOfSight(), boss_gluth::boss_gluthAI::MoveInLineOfSight(), npc_future_you::npc_future_youAI::MoveInLineOfSight(), npc_captain_saeed::npc_captain_saeedAI::MoveInLineOfSight(), npc_pet_hunter_snake_trap::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), boss_ayamiss::MovementInform(), boss_bug_trio::MovementInform(), boss_kaelthas::boss_kaelthasAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), boss_kagani_nightstrike::boss_kagani_nightstrikeAI::MovementInform(), npc_zelfrax::npc_zelfraxAI::MovementInform(), boss_twin_valkyrAI::myDoMeleeAttackIfReady(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MySelectNextTarget(), npc_pet_mage_mirror_image::MySelectNextTarget(), NecroticPlagueTargetCheck::operator()(), NonTankTargetSelector::operator()(), BoneStormMoveTargetSelector::operator()(), LastPhaseIceTombTargetSelector::operator()(), NonTankLKTargetSelector::operator()(), UnboundPlagueTargetSelector::operator()(), PetAI::OwnerAttacked(), npc_pet_gen_valkyr_guardian::OwnerAttacked(), PetAI::OwnerAttackedBy(), boss_nefarian::PathEndReached(), SmartScript::ProcessEvent(), SmartScript::ProcessEventsFor(), SmartScript::ProcessTimedAction(), npc_mograine::npc_mograineAI::PullCathedral(), boss_grobbulus::boss_grobbulusAI::PullChamberAdds(), Creature::ReleaseFocus(), npc_pet_hunter_snake_trap::Reset(), Resurrect(), npc_giant_claw_tentacle::ScheduleTasks(), SelectNearbyNoTotemTarget(), SelectNearbyTarget(), PetAI::SelectNextTarget(), UnitAI::SelectTargetList(), SmartAI::SetCombatMove(), SetConfused(), SetFeared(), SmartAI::SetForcedCombatMove(), SetStunned(), boss_razorscale::boss_razorscaleAI::SpellHit(), boss_garfrost::boss_garfrostAI::SpellHitTarget(), boss_quartermaster_zigris::SpellHitTarget(), boss_volkhan::boss_volkhanAI::SpellHitTarget(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::SpellHitTarget(), npc_escortAI::Start(), FollowerAI::StartFollow(), StopAttackFaction(), StopAttackingInvalidTarget(), SummonCroneIfReady(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), boss_dorothee::boss_dorotheeAI::SummonTito(), TauntApply(), TauntFadeOut(), npc_daphne_stilwell::npc_daphne_stilwellAI::Update(), Pet::Update(), Creature::Update(), Player::Update(), npc_razzashi_cobra_venoxis::npc_razzashi_cobra_venoxis_AI::UpdateAI(), CasterAI::UpdateAI(), ArcherAI::UpdateAI(), SimpleCharmedAI::UpdateAI(), npc_escortAI::UpdateAI(), boss_general_angerforge::boss_general_angerforgeAI::UpdateAI(), boss_gorosh_the_dervish::boss_gorosh_the_dervishAI::UpdateAI(), boss_grizzle::boss_grizzleAI::UpdateAI(), boss_hedrum::boss_hedrumAI::UpdateAI(), boss_okthor::boss_okthorAI::UpdateAI(), boss_drakkisath::boss_drakkisathAI::UpdateAI(), boss_quartermaster_zigris::UpdateAI(), npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI(), boss_broodlord::boss_broodlordAI::UpdateAI(), boss_firemaw::boss_firemawAI::UpdateAI(), boss_flamegor::boss_flamegorAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_midnight::boss_midnightAI::UpdateAI(), boss_attumen::boss_attumenAI::UpdateAI(), boss_attumen_midnight::boss_attumen_midnightAI::UpdateAI(), boss_nightbane::boss_nightbaneAI::UpdateAI(), boss_malchezaar::boss_malchezaarAI::UpdateAI(), boss_servant_quarters::UpdateAI(), boss_shade_of_aran::boss_aranAI::UpdateAI(), boss_terestian_illhoof::boss_terestianAI::UpdateAI(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::UpdateAI(), boss_kagani_nightstrike::boss_kagani_nightstrikeAI::UpdateAI(), boss_ellris_duskhallow::boss_ellris_duskhallowAI::UpdateAI(), boss_eramas_brightblaze::boss_eramas_brightblazeAI::UpdateAI(), boss_yazzai::boss_yazzaiAI::UpdateAI(), boss_warlord_salaris::boss_warlord_salarisAI::UpdateAI(), boss_garaxxas::boss_garaxxasAI::UpdateAI(), boss_zelfan::boss_zelfanAI::UpdateAI(), boss_selin_fireheart::boss_selin_fireheartAI::UpdateAI(), npc_death_knight_initiate::npc_death_knight_initiateAI::UpdateAI(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), npc_mograine::npc_mograineAI::UpdateAI(), boss_high_inquisitor_whitemane::boss_high_inquisitor_whitemaneAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), boss_brutallus::boss_brutallusAI::UpdateAI(), boss_sacrolash::boss_sacrolashAI::UpdateAI(), boss_alythess::boss_alythessAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), boss_kalec::boss_kalecAI::UpdateAI(), boss_sathrovarr::boss_sathrovarrAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_yenniku::npc_yennikuAI::UpdateAI(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_jaina_proudmoore_bfu::npc_jaina_proudmoore_bfuAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::UpdateAI(), boss_akilzon::boss_akilzonAI::UpdateAI(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::UpdateAI(), boss_fenstalker::boss_fenstalkerAI::UpdateAI(), boss_nalorakk::boss_nalorakkAI::UpdateAI(), boss_zuljin::boss_zuljinAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_marli::UpdateAI(), boss_headless_horseman::UpdateAI(), npc_frost_wyrm::npc_frost_wyrmAI::UpdateAI(), npc_gargoyle::npc_gargoyleAI::UpdateAI(), alliance_rifleman::alliance_riflemanAI::UpdateAI(), hyjalAI::UpdateAI(), boss_epoch::boss_epochAI::UpdateAI(), boss_infinite_corruptor::boss_infinite_corruptorAI::UpdateAI(), boss_mal_ganis::boss_mal_ganisAI::UpdateAI(), boss_salramm::boss_salrammAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), boss_captain_skarloc::boss_captain_skarlocAI::UpdateAI(), boss_epoch_hunter::boss_epoch_hunterAI::UpdateAI(), boss_lieutenant_drake::boss_lieutenant_drakeAI::UpdateAI(), boss_aeonus::boss_aeonusAI::UpdateAI(), boss_chrono_lord_deja::boss_chrono_lord_dejaAI::UpdateAI(), boss_temporus::boss_temporusAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_skeram::UpdateAI(), npc_muglash::npc_muglashAI::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), npc_aquementas::npc_aquementasAI::UpdateAI(), npc_plucky::npc_pluckyAI::UpdateAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::UpdateAI(), npc_shadowpriest_sezziz::npc_shadowpriest_sezzizAI::UpdateAI(), boss_taldaram::UpdateAI(), boss_hadronox::boss_hadronoxAI::UpdateAI(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::UpdateAI(), boss_krik_thir::boss_krik_thirAI::UpdateAI(), boss_sartharion::boss_sartharionAI::UpdateAI(), npc_twilight_summon::npc_twilight_summonAI::UpdateAI(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::UpdateAI(), npc_baltharus_the_warborn_clone::npc_baltharus_the_warborn_cloneAI::UpdateAI(), boss_general_zarithrian::boss_general_zarithrianAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_twilight_halion::boss_twilight_halionAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), npc_argent_soldier::npc_argent_soldierAI::UpdateAI(), boss_black_knight::boss_black_knightAI::UpdateAI(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::UpdateAI(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_toc_shaman::npc_toc_shamanAI::UpdateAI(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::UpdateAI(), npc_toc_warlock::npc_toc_warlockAI::UpdateAI(), npc_toc_mage::npc_toc_mageAI::UpdateAI(), npc_toc_hunter::npc_toc_hunterAI::UpdateAI(), npc_toc_boomkin::npc_toc_boomkinAI::UpdateAI(), npc_toc_warrior::npc_toc_warriorAI::UpdateAI(), npc_toc_dk::npc_toc_dkAI::UpdateAI(), npc_toc_rogue::npc_toc_rogueAI::UpdateAI(), npc_toc_pet_warlock::npc_toc_pet_warlockAI::UpdateAI(), npc_toc_pet_hunter::npc_toc_pet_hunterAI::UpdateAI(), boss_jaraxxus::boss_jaraxxusAI::UpdateAI(), npc_mistress_of_pain::npc_mistress_of_painAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_twin_valkyrAI::UpdateAI(), boss_dred::boss_dredAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), boss_trollgore::boss_trollgoreAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), boss_falric::boss_falricAI::UpdateAI(), boss_marwyn::boss_marwynAI::UpdateAI(), npc_phantom_mage::npc_phantom_mageAI::UpdateAI(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::UpdateAI(), npc_spectral_footman::npc_spectral_footmanAI::UpdateAI(), npc_tortured_rifleman::npc_tortured_riflemanAI::UpdateAI(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::UpdateAI(), npc_hor_risen_witch_doctor::npc_hor_risen_witch_doctorAI::UpdateAI(), npc_hor_lumbering_abomination::npc_hor_lumbering_abominationAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), boss_drakkari_elemental::boss_drakkari_elementalAI::UpdateAI(), npc_living_mojo::npc_living_mojoAI::UpdateAI(), boss_eck::boss_eckAI::UpdateAI(), boss_gal_darah::boss_gal_darahAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_slad_ran::boss_slad_ranAI::UpdateAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::UpdateAI(), npc_dark_nucleus::npc_dark_nucleusAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_festergut::boss_festergutAI::UpdateAI(), npc_stinky_icc::npc_stinky_iccAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), npc_gunship_boarding_add::npc_gunship_boarding_add_realAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_vengeful_shade::npc_vengeful_shadeAI::UpdateAI(), npc_darnavan::npc_darnavanAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), npc_big_ooze::npc_big_oozeAI::UpdateAI(), npc_precious_icc::npc_precious_iccAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_spinestalker::npc_spinestalkerAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::UpdateAI(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_spirit_warden::npc_spirit_wardenAI::UpdateAI(), npc_blazing_skeleton::npc_blazing_skeletonAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), npc_icc_skybreaker_hierophant::npc_icc_skybreaker_hierophantAI::UpdateAI(), npc_icc_skybreaker_marksman::npc_icc_skybreaker_marksmanAI::UpdateAI(), npc_icc_skybreaker_vicar::npc_icc_skybreaker_vicarAI::UpdateAI(), npc_icc_skybreaker_luminary::npc_icc_skybreaker_luminaryAI::UpdateAI(), npc_icc_severed_essence::npc_icc_severed_essenceAI::UpdateAI(), npc_icc_spire_frostwyrm::npc_icc_spire_frostwyrmAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::UpdateAI(), boss_isle_of_conquest::boss_isle_of_conquestAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), npc_boss_gothik_minion::npc_boss_gothik_minionAI::UpdateAI(), boss_grobbulus::boss_grobbulusAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::UpdateAI(), boss_maexxna::boss_maexxnaAI::UpdateAI(), boss_razuvious::boss_razuviousAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_nexus_lord::npc_nexus_lordAI::UpdateAI(), boss_anomalus::boss_anomalusAI::UpdateAI(), boss_commander_stoutbeard::boss_commander_stoutbeardAI::UpdateAI(), boss_keristrasza::boss_keristraszaAI::UpdateAI(), npc_crystalline_frayer::npc_crystalline_frayerAI::UpdateAI(), boss_eregos::boss_eregosAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), npc_stormforged_lieutenant::npc_stormforged_lieutenantAI::UpdateAI(), npc_molten_golem::npc_molten_golemAI::UpdateAI(), npc_hol_monument::npc_hol_monumentAI::UpdateAI(), boss_krystallus::boss_krystallusAI::UpdateAI(), boss_maiden_of_grief::boss_maiden_of_griefAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_steelbreaker::boss_steelbreakerAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_auriaya::boss_auriayaAI::UpdateAI(), npc_auriaya_sanctum_sentry::npc_auriaya_sanctum_sentryAI::UpdateAI(), npc_auriaya_feral_defender::npc_auriaya_feral_defenderAI::UpdateAI(), boss_flame_leviathan::boss_flame_leviathanAI::UpdateAI(), boss_freya_elder_ironbranch::boss_freya_elder_ironbranchAI::UpdateAI(), boss_freya_summons::boss_freya_summonsAI::UpdateAI(), boss_vezax::boss_vezaxAI::UpdateAI(), npc_ulduar_hodir_priest::npc_ulduar_hodir_priestAI::UpdateAI(), npc_ulduar_hodir_druid::npc_ulduar_hodir_druidAI::UpdateAI(), npc_ulduar_hodir_shaman::npc_ulduar_hodir_shamanAI::UpdateAI(), npc_ulduar_hodir_mage::npc_ulduar_hodir_mageAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), boss_kologarn::boss_kologarnAI::UpdateAI(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::UpdateAI(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), npc_ulduar_dark_rune_guardian::npc_ulduar_dark_rune_guardianAI::UpdateAI(), npc_ulduar_dark_rune_watcher::npc_ulduar_dark_rune_watcherAI::UpdateAI(), npc_ulduar_dark_rune_sentinel::npc_ulduar_dark_rune_sentinelAI::UpdateAI(), boss_thorim::boss_thorimAI::UpdateAI(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::UpdateAI(), boss_thorim_gauntlet_npcs::boss_thorim_gauntlet_npcsAI::UpdateAI(), boss_thorim_runic_colossus::boss_thorim_runic_colossusAI::UpdateAI(), boss_thorim_ancient_rune_giant::boss_thorim_ancient_rune_giantAI::UpdateAI(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::UpdateAI(), npc_xt002_pummeller::npc_xt002_pummellerAI::UpdateAI(), npc_ulduar_storm_tempered_keeper::npc_ulduar_storm_tempered_keeperAI::UpdateAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), boss_keleseth::boss_kelesethAI::UpdateAI(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::UpdateAI(), boss_skarvald_the_constructor::boss_skarvald_the_constructorAI::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), npc_ferocious_rhino::npc_ferocious_rhinoAI::UpdateAI(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::UpdateAI(), npc_frenzied_worgen::npc_frenzied_worgenAI::UpdateAI(), boss_skadi::boss_skadiAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_archavon::boss_archavonAI::UpdateAI(), boss_cyanigosa::boss_cyanigosaAI::UpdateAI(), boss_erekem::boss_erekemAI::UpdateAI(), npc_erekem_guard::npc_erekem_guardAI::UpdateAI(), boss_lavanthor::boss_lavanthorAI::UpdateAI(), boss_moragg::boss_moraggAI::UpdateAI(), boss_xevozz::boss_xevozzAI::UpdateAI(), npc_azure_invader::npc_azure_invaderAI::UpdateAI(), npc_azure_raider::npc_azure_raiderAI::UpdateAI(), npc_azure_captain::npc_azure_captainAI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), npc_wounded_skirmisher::UpdateAI(), npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::UpdateAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::UpdateAI(), npc_stolen_soul::npc_stolen_soulAI::UpdateAI(), boss_nexusprince_shaffar::boss_nexusprince_shaffarAI::UpdateAI(), npc_yor::npc_yorAI::UpdateAI(), boss_ambassador_hellmaw::boss_ambassador_hellmawAI::UpdateAI(), boss_murmur::boss_murmurAI::UpdateAI(), boss_gurtogg_bloodboil::boss_gurtogg_bloodboilAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_mother_shahraz::boss_shahrazAI::UpdateAI(), boss_essence_of_desire::boss_essence_of_desireAI::UpdateAI(), boss_essence_of_anger::boss_essence_of_angerAI::UpdateAI(), boss_shade_of_akama::boss_shade_of_akamaAI::UpdateAI(), npc_akama_shade::npc_akamaAI::UpdateAI(), boss_supremus::boss_supremusAI::UpdateAI(), boss_gathios_the_shatterer::boss_gathios_the_shattererAI::UpdateAI(), boss_high_nethermancer_zerevor::boss_high_nethermancer_zerevorAI::UpdateAI(), boss_lady_malande::boss_lady_malandeAI::UpdateAI(), boss_lady_vashj::boss_lady_vashjAI::UpdateAI(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::UpdateAI(), npc_inner_demon::npc_inner_demonAI::UpdateAI(), boss_the_lurker_below::boss_the_lurker_belowAI::UpdateAI(), boss_morogrim_tidewalker::boss_morogrim_tidewalkerAI::UpdateAI(), boss_mekgineer_steamrigger::boss_mekgineer_steamriggerAI::UpdateAI(), boss_gruul::boss_gruulAI::UpdateAI(), boss_high_king_maulgar::boss_high_king_maulgarAI::UpdateAI(), boss_kiggler_the_crazed::boss_kiggler_the_crazedAI::UpdateAI(), boss_krosh_firehand::boss_krosh_firehandAI::UpdateAI(), boss_broggok::boss_broggokAI::UpdateAI(), npc_shadowmoon_channeler::npc_shadowmoon_channelerAI::UpdateAI(), boss_omor_the_unscarred::boss_omor_the_unscarredAI::UpdateAI(), boss_nazan::boss_nazanAI::UpdateAI(), boss_vazruden::boss_vazrudenAI::UpdateAI(), boss_watchkeeper_gargolmar::boss_watchkeeper_gargolmarAI::UpdateAI(), boss_magtheridon::boss_magtheridonAI::UpdateAI(), boss_grand_warlock_nethekurse::boss_grand_warlock_nethekurseAI::UpdateAI(), boss_warchief_kargath_bladefist::boss_warchief_kargath_bladefistAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), boss_dalliah_the_doomsayer::boss_dalliah_the_doomsayerAI::UpdateAI(), boss_wrath_scryer_soccothrates::boss_wrath_scryer_soccothratesAI::UpdateAI(), boss_commander_sarannis::boss_commander_sarannisAI::UpdateAI(), boss_high_botanist_freywinn::boss_high_botanist_freywinnAI::UpdateAI(), boss_laj::boss_lajAI::UpdateAI(), boss_alar::boss_alarAI::UpdateAI(), boss_high_astromancer_solarian::boss_high_astromancer_solarianAI::UpdateAI(), boss_kaelthas::boss_kaelthasAI::UpdateAI(), boss_void_reaver::boss_void_reaverAI::UpdateAI(), boss_gatewatcher_gyrokill::boss_gatewatcher_gyrokillAI::UpdateAI(), boss_gatewatcher_iron_hand::boss_gatewatcher_iron_handAI::UpdateAI(), boss_mechano_lord_capacitus::boss_mechano_lord_capacitusAI::UpdateAI(), boss_nethermancer_sepethrea::boss_nethermancer_sepethreaAI::UpdateAI(), npc_ragin_flames::npc_ragin_flamesAI::UpdateAI(), npc_nether_drake::npc_nether_drakeAI::UpdateAI(), adyen_the_lightbringer::adyen_the_lightbringerAI::UpdateAI(), anchorite_karja::anchorite_karjaAI::UpdateAI(), exarch_orelis::exarch_orelisAI::UpdateAI(), socrethar::socretharAI::UpdateAI(), kaylaan_the_lost::kaylaan_the_lostAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_ishanah::ishanahAI::UpdateAI(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::UpdateAI(), npc_pet_gen_valkyr_guardian::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), npc_pet_shaman_fire_elemental::UpdateAI(), guard_shattrath_scryer::guard_shattrath_scryerAI::UpdateAI(), guard_shattrath_aldor::guard_shattrath_aldorAI::UpdateAI(), generic_creature::generic_creatureAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), PossessedAI::UpdateAI(), PetAI::UpdateAI(), FollowerAI::UpdateAI(), npc_zuljin_vortex::npc_zuljin_vortexAI::UpdateAI(), npc_suppresser::npc_suppresserAI::UpdateAI(), npc_xt002_life_spark::npc_xt002_life_sparkAI::UpdateAI(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::UpdateAI(), npc_pet_gen_gnomish_flame_turret::UpdateAI(), Player::UpdateCharmedAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateEscortAI(), boss_bjarngrim::boss_bjarngrimAI::UpdateEscortAI(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::UpdateEscortAI(), npc_akama_illidan::npc_akama_illidanAI::UpdateEscortAI(), npc_isla_starmane::npc_isla_starmaneAI::UpdateEscortAI(), Player::UpdateFFAPvPFlag(), Player::UpdateFFAPvPState(), SmartAI::UpdatePath(), boss_netherspite::boss_netherspiteAI::UpdatePortals(), CreatureAI::UpdateVictim(), CreatureAI::UpdateVictimWithGaze(), and boss_hexlord_malacrass::boss_hex_lord_malacrassAI::UseAbility().

◆ GetVisibleAura()

AuraApplication * Unit::GetVisibleAura ( uint8  slot)
inline
2153 {
2154 VisibleAuraMap::iterator itr = m_visibleAuras.find(slot);
2155 if (itr != m_visibleAuras.end())
2156 return itr->second;
2157 return nullptr;
2158 }

References m_visibleAuras.

Referenced by WorldSession::BuildPartyMemberStatsChangedPacket(), AuraApplication::BuildUpdatePacket(), and WorldSession::HandleRequestPartyMemberStatsOpcode().

◆ GetVisibleAuras()

◆ GetWeaponDamageRange()

float Unit::GetWeaponDamageRange ( WeaponAttackType  attType,
WeaponDamageRange  type,
uint8  damageIndex = 0 
) const
15340{
15341 if (attType == OFF_ATTACK && !haveOffhandWeapon())
15342 return 0.0f;
15343
15344 return m_weaponDamage[attType][type][damageIndex];
15345}

References haveOffhandWeapon(), m_weaponDamage, and OFF_ATTACK.

Referenced by Player::_ApplyWeaponDamage(), Creature::CalculateMinMaxDamage(), Player::CalculateMinMaxDamage(), and Guardian::UpdateDamagePhysical().

◆ GetWeaponProcChance()

float Unit::GetWeaponProcChance ( ) const
13357{
13358 // normalized proc chance for weapon attack speed
13359 // (odd formula...)
13361 return (GetAttackTime(BASE_ATTACK) * 1.8f / 1000.0f);
13363 return (GetAttackTime(OFF_ATTACK) * 1.6f / 1000.0f);
13364 return 0;
13365}

References BASE_ATTACK, GetAttackTime(), haveOffhandWeapon(), isAttackReady(), and OFF_ATTACK.

Referenced by Player::CastItemCombatSpell().

◆ GetWeaponSkillValue()

uint32 Unit::GetWeaponSkillValue ( WeaponAttackType  attType,
Unit const *  target = nullptr 
) const
3744{
3745 uint32 value = 0;
3746 if (Player const* player = ToPlayer())
3747 {
3748 Item* item = player->GetWeaponForAttack(attType, true);
3749
3750 // feral or unarmed skill only for base attack
3751 if (attType != BASE_ATTACK && !item)
3752 return 0;
3753
3754 if (IsInFeralForm())
3755 return GetMaxSkillValueForLevel(); // always maximized SKILL_FERAL_COMBAT in fact
3756
3757 // weapon skill or (unarmed for base attack)
3758 uint32 skill = SKILL_UNARMED;
3759 if (item)
3760 skill = item->GetSkill();
3761
3762 // in PvP use full skill instead current skill value
3763 value = (target && target->IsControlledByPlayer())
3764 ? player->GetMaxSkillValue(skill)
3765 : player->GetSkillValue(skill);
3766 // Modify value from ratings
3767 value += uint32(player->GetRatingBonusValue(CR_WEAPON_SKILL));
3768 switch (attType)
3769 {
3770 case BASE_ATTACK:
3771 value += uint32(player->GetRatingBonusValue(CR_WEAPON_SKILL_MAINHAND));
3772 break;
3773 case OFF_ATTACK:
3774 value += uint32(player->GetRatingBonusValue(CR_WEAPON_SKILL_OFFHAND));
3775 break;
3776 case RANGED_ATTACK:
3777 value += uint32(player->GetRatingBonusValue(CR_WEAPON_SKILL_RANGED));
3778 break;
3779 default:
3780 break;
3781 }
3782 }
3783 else
3784 value = GetUnitMeleeSkill(target);
3785 return value;
3786}
@ CR_WEAPON_SKILL_RANGED
Definition: Unit.h:426
@ CR_WEAPON_SKILL
Definition: Unit.h:404
@ CR_WEAPON_SKILL_OFFHAND
Definition: Unit.h:425
@ CR_WEAPON_SKILL_MAINHAND
Definition: Unit.h:424
@ SKILL_UNARMED
Definition: SharedDefines.h:2879
uint32 GetSkill()
Definition: Item.cpp:557
bool IsInFeralForm() const
Definition: Unit.h:2077

References BASE_ATTACK, CR_WEAPON_SKILL, CR_WEAPON_SKILL_MAINHAND, CR_WEAPON_SKILL_OFFHAND, CR_WEAPON_SKILL_RANGED, GetMaxSkillValueForLevel(), Item::GetSkill(), GetUnitMeleeSkill(), IsControlledByPlayer(), IsInFeralForm(), OFF_ATTACK, RANGED_ATTACK, SKILL_UNARMED, and Object::ToPlayer().

Referenced by isSpellBlocked(), MeleeSpellHitResult(), RollMeleeOutcomeAgainst(), and Player::UpdateCritPercentage().

◆ HandleAuraProc()

bool Unit::HandleAuraProc ( Unit victim,
uint32  damage,
Aura triggeredByAura,
SpellInfo const *  procSpell,
uint32  procFlag,
uint32  procEx,
uint32  cooldown,
bool *  handled 
)
private
8691{
8692 SpellInfo const* dummySpell = triggeredByAura->GetSpellInfo();
8693
8694 switch (dummySpell->SpellFamilyName)
8695 {
8697 switch (dummySpell->Id)
8698 {
8699 // Nevermelting Ice Crystal
8700 case 71564:
8701 RemoveAuraFromStack(71564);
8702 *handled = true;
8703 break;
8704 // Gaseous Bloat
8705 case 70672:
8706 case 72455:
8707 case 72832:
8708 case 72833:
8709 {
8710 if (Unit* caster = triggeredByAura->GetCaster())
8711 if (victim && caster->GetGUID() == victim->GetGUID())
8712 {
8713 *handled = true;
8714 uint32 stack = triggeredByAura->GetStackAmount();
8715 int32 const mod = (GetMap()->GetSpawnMode() & 1) ? 1500 : 1250;
8716 int32 dmg = 0;
8717 for (uint8 i = 1; i <= stack; ++i)
8718 dmg += mod * i;
8719 caster->CastCustomSpell(70701, SPELLVALUE_BASE_POINT0, dmg);
8720 }
8721 break;
8722 }
8723 // Ball of Flames Proc
8724 case 71756:
8725 case 72782:
8726 case 72783:
8727 case 72784:
8728 RemoveAuraFromStack(dummySpell->Id);
8729 *handled = true;
8730 break;
8731 // Discerning Eye of the Beast
8732 case 59915:
8733 {
8734 CastSpell(this, 59914, true); // 59914 already has correct basepoints in DBC, no need for custom bp
8735 *handled = true;
8736 break;
8737 }
8738 // Swift Hand of Justice
8739 case 59906:
8740 {
8741 int32 bp0 = CalculatePct(GetMaxHealth(), dummySpell->Effects[EFFECT_0]. CalcValue());
8742 CastCustomSpell(this, 59913, &bp0, nullptr, nullptr, true);
8743 *handled = true;
8744 break;
8745 }
8746 }
8747
8748 break;
8749 case SPELLFAMILY_MAGE:
8750 {
8751 // Combustion
8752 switch (dummySpell->Id)
8753 {
8754 case 11129:
8755 {
8756 *handled = true;
8757 Unit* caster = triggeredByAura->GetCaster();
8758 if (!caster || !damage)
8759 return false;
8760
8761 // last charge and crit
8762 if (triggeredByAura->GetCharges() <= 1 && (procEx & PROC_EX_CRITICAL_HIT))
8763 return true; // charge counting (will removed)
8764
8765 CastSpell(this, 28682, true);
8766
8767 return procEx & PROC_EX_CRITICAL_HIT;
8768 }
8769 // Empowered Fire
8770 case 31656:
8771 case 31657:
8772 case 31658:
8773 {
8774 *handled = true;
8775
8776 SpellInfo const* spInfo = sSpellMgr->GetSpellInfo(67545);
8777 if (!spInfo)
8778 return false;
8779
8780 int32 bp0 = int32(CalculatePct(GetMaxPower(POWER_MANA), spInfo->Effects[0].CalcValue()));
8781 CastCustomSpell(this, 67545, &bp0, nullptr, nullptr, true, nullptr, triggeredByAura->GetEffect(EFFECT_0), GetGUID());
8782 return true;
8783 }
8784 }
8785 break;
8786 }
8788 {
8789 // Blood of the North
8790 // Reaping
8791 // Death Rune Mastery
8792 // xinef: Icon 22 is used for item bonus, skip
8793 if (dummySpell->SpellIconID == 3041 || (dummySpell->SpellIconID == 22 && dummySpell->Id != 62459) || dummySpell->SpellIconID == 2622)
8794 {
8795 *handled = true;
8796 // Convert recently used Blood Rune to Death Rune
8797 if (Player* player = ToPlayer())
8798 {
8799 if (player->getClass() != CLASS_DEATH_KNIGHT)
8800 return false;
8801
8802 // xinef: not true
8803 //RuneType rune = ToPlayer()->GetLastUsedRune();
8804 // can't proc from death rune use
8805 //if (rune == RUNE_DEATH)
8806 // return false;
8807 AuraEffect* aurEff = triggeredByAura->GetEffect(EFFECT_0);
8808 if (!aurEff)
8809 return false;
8810
8811 // Reset amplitude - set death rune remove timer to 30s
8812 aurEff->ResetPeriodic(true);
8813 uint32 runesLeft;
8814
8815 if (dummySpell->SpellIconID == 2622)
8816 runesLeft = 2;
8817 else
8818 runesLeft = 1;
8819
8820 for (uint8 i = 0; i < MAX_RUNES && runesLeft; ++i)
8821 {
8822 if (dummySpell->SpellIconID == 2622)
8823 {
8824 if (player->GetCurrentRune(i) == RUNE_DEATH ||
8825 player->GetBaseRune(i) == RUNE_BLOOD)
8826 continue;
8827 }
8828 else
8829 {
8830 if (player->GetCurrentRune(i) == RUNE_DEATH ||
8831 player->GetBaseRune(i) != RUNE_BLOOD)
8832 continue;
8833 }
8834 if (player->GetRuneCooldown(i) != player->GetRuneBaseCooldown(i, false))
8835 continue;
8836
8837 --runesLeft;
8838 // Mark aura as used
8839 player->AddRuneByAuraEffect(i, RUNE_DEATH, aurEff);
8840 }
8841 return true;
8842 }
8843 return false;
8844 }
8845 break;
8846 }
8848 {
8849 switch (dummySpell->Id)
8850 {
8851 // Item - Warrior T10 Protection 4P Bonus
8852 case 70844:
8853 {
8854 int32 basepoints0 = CalculatePct(GetMaxHealth(), dummySpell->Effects[EFFECT_1]. CalcValue());
8855 CastCustomSpell(this, 70845, &basepoints0, nullptr, nullptr, true);
8856 break;
8857 }
8858 default:
8859 break;
8860 }
8861 break;
8862 }
8863 case SPELLFAMILY_SHAMAN:
8864 {
8865 // Flurry
8866 if ((dummySpell->SpellFamilyFlags[1] & 0x00000200) != 0)
8867 {
8868 if (cooldown)
8869 {
8870 if (HasSpellCooldown(dummySpell->Id))
8871 {
8872 *handled = true;
8873 break;
8874 }
8875
8876 AddSpellCooldown(dummySpell->Id, 0, cooldown);
8877 }
8878 }
8879 break;
8880 }
8881 }
8882 return false;
8883}
@ RUNE_DEATH
Definition: Player.h:413
@ RUNE_BLOOD
Definition: Player.h:410
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
@ SPELLFAMILY_MAGE
Definition: SharedDefines.h:3503
@ SPELLFAMILY_GENERIC
Definition: SharedDefines.h:3500
@ SPELLFAMILY_WARRIOR
Definition: SharedDefines.h:3504
@ SPELLFAMILY_SHAMAN
Definition: SharedDefines.h:3511
@ SPELLFAMILY_DEATHKNIGHT
Definition: SharedDefines.h:3515
virtual bool HasSpellCooldown(uint32) const
Definition: Unit.h:2418
virtual void AddSpellCooldown(uint32, uint32, uint32, bool needSendToClient=false, bool forceSendToSpectator=false)
Definition: Unit.h:2420
void RemoveAuraFromStack(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4851
uint8 GetSpawnMode() const
Definition: Map.h:419
void ResetPeriodic(bool resetPeriodicTimer=false)
Definition: SpellAuraEffects.h:88
AuraEffect * GetEffect(uint8 effIndex) const
Definition: SpellAuras.h:175

References AddSpellCooldown(), CalculatePct(), CastCustomSpell(), CastSpell(), CLASS_DEATH_KNIGHT, EFFECT_0, EFFECT_1, SpellInfo::Effects, Aura::GetCaster(), Aura::GetCharges(), Aura::GetEffect(), Object::GetGUID(), WorldObject::GetMap(), GetMaxHealth(), GetMaxPower(), Map::GetSpawnMode(), Aura::GetSpellInfo(), Aura::GetStackAmount(), HasSpellCooldown(), SpellInfo::Id, MAX_RUNES, POWER_MANA, PROC_EX_CRITICAL_HIT, RemoveAuraFromStack(), AuraEffect::ResetPeriodic(), RUNE_BLOOD, RUNE_DEATH, SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_GENERIC, SPELLFAMILY_MAGE, SPELLFAMILY_SHAMAN, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, SPELLVALUE_BASE_POINT0, sSpellMgr, and Object::ToPlayer().

Referenced by ProcDamageAndSpellFor().

◆ HandleAuraRaidProcFromCharge()

bool Unit::HandleAuraRaidProcFromCharge ( AuraEffect triggeredByAura)
private
17786{
17787 // aura can be deleted at casts
17788 SpellInfo const* spellProto = triggeredByAura->GetSpellInfo();
17789
17790 uint32 damageSpellId;
17791 switch (spellProto->Id)
17792 {
17793 case 57949: // shiver
17794 damageSpellId = 57952;
17795 //animationSpellId = 57951; dummy effects for jump spell have unknown use (see also 41637)
17796 break;
17797 case 59978: // shiver
17798 damageSpellId = 59979;
17799 break;
17800 case 43593: // Cold Stare
17801 damageSpellId = 43594;
17802 break;
17803 default:
17804 LOG_ERROR("entities.unit", "Unit::HandleAuraRaidProcFromCharge, received unhandled spell: {}", spellProto->Id);
17805 return false;
17806 }
17807
17808 ObjectGuid caster_guid = triggeredByAura->GetCasterGUID();
17809
17810 // jumps
17811 int32 jumps = triggeredByAura->GetBase()->GetCharges() - 1;
17812
17813 // current aura expire
17814 triggeredByAura->GetBase()->SetCharges(1); // will removed at next charges decrease
17815
17816 // next target selection
17817 if (jumps > 0)
17818 {
17819 if (Unit* caster = triggeredByAura->GetCaster())
17820 {
17821 float radius = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcRadius(caster);
17822 if (Unit* target = GetNextRandomRaidMemberOrPet(radius))
17823 {
17824 CastSpell(target, spellProto, true, nullptr, triggeredByAura, caster_guid);
17825 if (Aura* aura = target->GetAura(spellProto->Id, caster->GetGUID()))
17826 aura->SetCharges(jumps);
17827 }
17828 }
17829 }
17830
17831 CastSpell(this, damageSpellId, true, nullptr, triggeredByAura, caster_guid);
17832
17833 return true;
17834}
Unit * GetNextRandomRaidMemberOrPet(float radius)
Definition: Unit.cpp:11074
void SetCharges(uint8 charges)
Definition: SpellAuras.cpp:966

References CastSpell(), SpellInfo::Effects, AuraEffect::GetBase(), AuraEffect::GetCaster(), AuraEffect::GetCasterGUID(), Aura::GetCharges(), AuraEffect::GetEffIndex(), GetNextRandomRaidMemberOrPet(), AuraEffect::GetSpellInfo(), SpellInfo::Id, LOG_ERROR, and Aura::SetCharges().

Referenced by ProcDamageAndSpellFor().

◆ HandleAuraRaidProcFromChargeWithValue()

bool Unit::HandleAuraRaidProcFromChargeWithValue ( AuraEffect triggeredByAura)
private
17697{
17698 // aura can be deleted at casts
17699 SpellInfo const* spellProto = triggeredByAura->GetSpellInfo();
17700 int32 heal = triggeredByAura->GetAmount();
17701 ObjectGuid caster_guid = triggeredByAura->GetCasterGUID();
17702
17703 // Currently only Prayer of Mending
17704 if (!(spellProto->SpellFamilyName == SPELLFAMILY_PRIEST && spellProto->SpellFamilyFlags[1] & 0x20))
17705 {
17706 LOG_DEBUG("spells.aura", "Unit::HandleAuraRaidProcFromChargeWithValue, received not handled spell: {}", spellProto->Id);
17707 return false;
17708 }
17709
17710 // jumps
17711 int32 jumps = triggeredByAura->GetBase()->GetCharges() - 1;
17712
17713 // current aura expire
17714 triggeredByAura->GetBase()->SetCharges(1); // will removed at next charges decrease
17715
17716 // next target selection
17717 if (jumps > 0)
17718 {
17719 if (Unit* caster = triggeredByAura->GetCaster())
17720 {
17721 // smart healing
17722 float radius = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcRadius(caster);
17723 std::list<Unit*> nearMembers;
17724
17725 Player* player = nullptr;
17726 if (GetTypeId() == TYPEID_PLAYER)
17727 player = ToPlayer();
17728 else if (GetOwner())
17729 player = GetOwner()->ToPlayer();
17730
17731 if (player)
17732 {
17733 Group* group = player->GetGroup();
17734 if (!group)
17735 {
17736 if (player != this)
17737 {
17738 if (IsWithinDistInMap(player, radius))
17739 nearMembers.push_back(player);
17740 }
17741 else if (Unit* pet = GetGuardianPet())
17742 {
17743 if (IsWithinDistInMap(pet, radius))
17744 nearMembers.push_back(pet);
17745 }
17746 }
17747 else
17748 {
17749 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
17750 if (Player* Target = itr->GetSource())
17751 {
17752 if (Target != this && !IsWithinDistInMap(Target, radius))
17753 continue;
17754
17755 // IsHostileTo check duel and controlled by enemy
17756 if (Target != this && Target->IsAlive() && !IsHostileTo(Target))
17757 nearMembers.push_back(Target);
17758
17759 // Push player's pet to vector
17760 if (Unit* pet = Target->GetGuardianPet())
17761 if (pet != this && pet->IsAlive() && IsWithinDistInMap(pet, radius) && !IsHostileTo(pet))
17762 nearMembers.push_back(pet);
17763 }
17764 }
17765
17766 if (!nearMembers.empty())
17767 {
17768 nearMembers.sort(Acore::HealthPctOrderPred());
17769 if (Unit* target = nearMembers.front())
17770 {
17771 CastSpell(target, 41637 /*Dummy visual effect triggered by main spell cast*/, true);
17772 CastCustomSpell(target, spellProto->Id, &heal, nullptr, nullptr, true, nullptr, triggeredByAura, caster_guid);
17773 if (Aura* aura = target->GetAura(spellProto->Id, caster->GetGUID()))
17774 aura->SetCharges(jumps);
17775 }
17776 }
17777 }
17778 }
17779 }
17780
17781 // heal
17782 CastCustomSpell(this, 33110, &heal, nullptr, nullptr, true, nullptr, nullptr, caster_guid);
17783 return true;
17784}
@ SPELLFAMILY_PRIEST
Definition: SharedDefines.h:3506
Definition: Unit.h:2630

References CastCustomSpell(), CastSpell(), SpellInfo::Effects, AuraEffect::GetAmount(), AuraEffect::GetBase(), AuraEffect::GetCaster(), AuraEffect::GetCasterGUID(), Aura::GetCharges(), AuraEffect::GetEffIndex(), Group::GetFirstMember(), Player::GetGroup(), GetGuardianPet(), GetOwner(), AuraEffect::GetSpellInfo(), Object::GetTypeId(), SpellInfo::Id, IsHostileTo(), WorldObject::IsWithinDistInMap(), LOG_DEBUG, GroupReference::next(), Aura::SetCharges(), SPELLFAMILY_PRIEST, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by ProcDamageAndSpellFor().

◆ HandleDummyAuraProc()

bool Unit::HandleDummyAuraProc ( Unit victim,
uint32  damage,
AuraEffect triggeredByAura,
SpellInfo const *  procSpell,
uint32  procFlag,
uint32  procEx,
uint32  cooldown,
Spell const *  spellProc = nullptr 
)
private
6502{
6503 SpellInfo const* dummySpell = triggeredByAura->GetSpellInfo();
6504 uint32 effIndex = triggeredByAura->GetEffIndex();
6505 int32 triggerAmount = triggeredByAura->GetAmount();
6506
6507 Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER
6508 ? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : nullptr;
6509
6510 uint32 triggered_spell_id = 0;
6511 uint32 cooldown_spell_id = 0; // for random trigger, will be one of the triggered spell to avoid repeatable triggers
6512 // otherwise, it's the triggered_spell_id by default
6513 Unit* target = victim;
6514 int32 basepoints0 = 0;
6515 ObjectGuid originalCaster;
6516
6517 switch (dummySpell->SpellFamilyName)
6518 {
6520 {
6521 switch (dummySpell->Id)
6522 {
6523 // Overkill
6524 case 58426:
6525 {
6526 triggered_spell_id = 58427;
6527 break;
6528 }
6529 // Unstable Power
6530 case 24658:
6531 {
6532 if (!procSpell || procSpell->Id == 24659)
6533 return false;
6534 // Need remove one 24659 aura
6535 RemoveAuraFromStack(24659);
6536 return true;
6537 }
6538 // Restless Strength
6539 case 24661:
6540 {
6541 // Need remove one 24662 aura
6542 RemoveAuraFromStack(24662);
6543 return true;
6544 }
6545 // Mark of Malice
6546 case 33493:
6547 {
6548 if (triggeredByAura->GetBase()->GetCharges() > 1)
6549 return true;
6550
6551 target = this;
6552 triggered_spell_id = 33494;
6553 break;
6554 }
6555 // Twisted Reflection (boss spell)
6556 case 21063:
6557 triggered_spell_id = 21064;
6558 break;
6559 // Vampiric Aura (boss spell)
6560 case 38196:
6561 {
6562 basepoints0 = 3 * damage; // 300%
6563 if (basepoints0 < 0)
6564 return false;
6565
6566 triggered_spell_id = 31285;
6567 target = this;
6568 break;
6569 }
6570 // Aura of Madness (Darkmoon Card: Madness trinket)
6571 //=====================================================
6572 // 39511 Sociopath: +35 strength (Paladin, Rogue, Druid, Warrior)
6573 // 40997 Delusional: +70 attack power (Rogue, Hunter, Paladin, Warrior, Druid)
6574 // 40998 Kleptomania: +35 agility (Warrior, Rogue, Paladin, Hunter, Druid)
6575 // 40999 Megalomania: +41 damage/healing (Druid, Shaman, Priest, Warlock, Mage, Paladin)
6576 // 41002 Paranoia: +35 spell/melee/ranged crit strike rating (All classes)
6577 // 41005 Manic: +35 haste (spell, melee and ranged) (All classes)
6578 // 41009 Narcissism: +35 intellect (Druid, Shaman, Priest, Warlock, Mage, Paladin, Hunter)
6579 // 41011 Martyr Complex: +35 stamina (All classes)
6580 // 41406 Dementia: Every 5 seconds either gives you +5% damage/healing. (Druid, Shaman, Priest, Warlock, Mage, Paladin)
6581 // 41409 Dementia: Every 5 seconds either gives you -5% damage/healing. (Druid, Shaman, Priest, Warlock, Mage, Paladin)
6582 case 39446:
6583 {
6584 if (GetTypeId() != TYPEID_PLAYER || !IsAlive())
6585 return false;
6586
6587 // Select class defined buff
6588 switch (getClass())
6589 {
6590 case CLASS_PALADIN: // 39511, 40997, 40998, 40999, 41002, 41005, 41009, 41011, 41409
6591 case CLASS_DRUID: // 39511, 40997, 40998, 40999, 41002, 41005, 41009, 41011, 41409
6592 triggered_spell_id = RAND(39511, 40997, 40998, 40999, 41002, 41005, 41009, 41011, 41409);
6593 cooldown_spell_id = 39511;
6594 break;
6595 case CLASS_ROGUE: // 39511, 40997, 40998, 41002, 41005, 41011
6596 case CLASS_WARRIOR: // 39511, 40997, 40998, 41002, 41005, 41011
6597 case CLASS_DEATH_KNIGHT:
6598 triggered_spell_id = RAND(39511, 40997, 40998, 41002, 41005, 41011);
6599 cooldown_spell_id = 39511;
6600 break;
6601 case CLASS_PRIEST: // 40999, 41002, 41005, 41009, 41011, 41406, 41409
6602 case CLASS_SHAMAN: // 40999, 41002, 41005, 41009, 41011, 41406, 41409
6603 case CLASS_MAGE: // 40999, 41002, 41005, 41009, 41011, 41406, 41409
6604 case CLASS_WARLOCK: // 40999, 41002, 41005, 41009, 41011, 41406, 41409
6605 triggered_spell_id = RAND(40999, 41002, 41005, 41009, 41011, 41406, 41409);
6606 cooldown_spell_id = 40999;
6607 break;
6608 case CLASS_HUNTER: // 40997, 40999, 41002, 41005, 41009, 41011, 41406, 41409
6609 triggered_spell_id = RAND(40997, 40999, 41002, 41005, 41009, 41011, 41406, 41409);
6610 cooldown_spell_id = 40997;
6611 break;
6612 default:
6613 return false;
6614 }
6615
6616 target = this;
6617 if (roll_chance_i(10))
6618 ToPlayer()->Say("This is Madness!", LANG_UNIVERSAL); // TODO: It should be moved to database, shouldn't it?
6619 break;
6620 }
6621 // Sunwell Exalted Caster Neck (??? neck)
6622 // cast ??? Light's Wrath if Exalted by Aldor
6623 // cast ??? Arcane Bolt if Exalted by Scryers
6624 case 46569:
6625 return false; // old unused version
6626 // Sunwell Exalted Caster Neck (Shattered Sun Pendant of Acumen neck)
6627 // cast 45479 Light's Wrath if Exalted by Aldor
6628 // cast 45429 Arcane Bolt if Exalted by Scryers
6629 case 45481:
6630 {
6631 Player* player = ToPlayer();
6632 if (!player)
6633 return false;
6634
6635 // Get Aldor reputation rank
6636 if (player->GetReputationRank(932) == REP_EXALTED)
6637 {
6638 target = this;
6639 triggered_spell_id = 45479;
6640 break;
6641 }
6642 // Get Scryers reputation rank
6643 if (player->GetReputationRank(934) == REP_EXALTED)
6644 {
6645 // triggered at positive/self casts also, current attack target used then
6646 if (target && IsFriendlyTo(target))
6647 {
6648 target = GetVictim();
6649 if (!target)
6650 {
6651 target = player->GetSelectedUnit();
6652 if (!target)
6653 return false;
6654 }
6655 if (IsFriendlyTo(target))
6656 return false;
6657 }
6658
6659 triggered_spell_id = 45429;
6660 break;
6661 }
6662 return false;
6663 }
6664 // Sunwell Exalted Melee Neck (Shattered Sun Pendant of Might neck)
6665 // cast 45480 Light's Strength if Exalted by Aldor
6666 // cast 45428 Arcane Strike if Exalted by Scryers
6667 case 45482:
6668 {
6669 if (GetTypeId() != TYPEID_PLAYER)
6670 return false;
6671
6672 // Get Aldor reputation rank
6673 if (ToPlayer()->GetReputationRank(932) == REP_EXALTED)
6674 {
6675 target = this;
6676 triggered_spell_id = 45480;
6677 break;
6678 }
6679 // Get Scryers reputation rank
6680 if (ToPlayer()->GetReputationRank(934) == REP_EXALTED)
6681 {
6682 triggered_spell_id = 45428;
6683 break;
6684 }
6685 return false;
6686 }
6687 // Sunwell Exalted Tank Neck (Shattered Sun Pendant of Resolve neck)
6688 // cast 45431 Arcane Insight if Exalted by Aldor
6689 // cast 45432 Light's Ward if Exalted by Scryers
6690 case 45483:
6691 {
6692 if (GetTypeId() != TYPEID_PLAYER)
6693 return false;
6694
6695 // Get Aldor reputation rank
6696 if (ToPlayer()->GetReputationRank(932) == REP_EXALTED)
6697 {
6698 target = this;
6699 triggered_spell_id = 45432;
6700 break;
6701 }
6702 // Get Scryers reputation rank
6703 if (ToPlayer()->GetReputationRank(934) == REP_EXALTED)
6704 {
6705 target = this;
6706 triggered_spell_id = 45431;
6707 break;
6708 }
6709 return false;
6710 }
6711 // Sunwell Exalted Healer Neck (Shattered Sun Pendant of Restoration neck)
6712 // cast 45478 Light's Salvation if Exalted by Aldor
6713 // cast 45430 Arcane Surge if Exalted by Scryers
6714 case 45484:
6715 {
6716 if (GetTypeId() != TYPEID_PLAYER)
6717 return false;
6718
6719 // Get Aldor reputation rank
6720 if (ToPlayer()->GetReputationRank(932) == REP_EXALTED)
6721 {
6722 target = this;
6723 triggered_spell_id = 45478;
6724 break;
6725 }
6726 // Get Scryers reputation rank
6727 if (ToPlayer()->GetReputationRank(934) == REP_EXALTED)
6728 {
6729 triggered_spell_id = 45430;
6730 break;
6731 }
6732 return false;
6733 }
6734 // Kill command
6735 case 58914:
6736 {
6737 // Remove aura stack from pet
6738 RemoveAuraFromStack(58914);
6739 Unit* owner = GetOwner();
6740 if (!owner)
6741 return true;
6742 // reduce the owner's aura stack
6743 owner->RemoveAuraFromStack(34027);
6744 return true;
6745 }
6746 // Vampiric Touch (generic, used by some boss)
6747 case 52723:
6748 case 60501:
6749 {
6750 triggered_spell_id = 52724;
6751 basepoints0 = damage / 2;
6752 target = this;
6753 break;
6754 }
6755 // Divine purpose
6756 case 31871:
6757 case 31872:
6758 {
6759 // Roll chane
6760 if (!victim || !victim->IsAlive() || !roll_chance_i(triggerAmount))
6761 return false;
6762
6763 // Remove any stun effect on target
6765 return true;
6766 }
6767 // Glyph of Life Tap
6768 case 63320:
6769 {
6770 triggered_spell_id = 63321; // Life Tap
6771 break;
6772 }
6773 case 71519: // Deathbringer's Will Normal
6774 {
6775 if (GetTypeId() != TYPEID_PLAYER || HasSpellCooldown(71484))
6776 return false;
6777
6778 AddSpellCooldown(71484, 0, cooldown);
6779
6780 std::vector<uint32> RandomSpells;
6781 switch (getClass())
6782 {
6783 case CLASS_WARRIOR:
6784 case CLASS_PALADIN:
6785 case CLASS_DEATH_KNIGHT:
6786 RandomSpells.push_back(71484);
6787 RandomSpells.push_back(71491);
6788 RandomSpells.push_back(71492);
6789 break;
6790 case CLASS_SHAMAN:
6791 case CLASS_ROGUE:
6792 RandomSpells.push_back(71486);
6793 RandomSpells.push_back(71485);
6794 RandomSpells.push_back(71492);
6795 break;
6796 case CLASS_DRUID:
6797 RandomSpells.push_back(71484);
6798 RandomSpells.push_back(71485);
6799 RandomSpells.push_back(71492);
6800 break;
6801 case CLASS_HUNTER:
6802 RandomSpells.push_back(71486);
6803 RandomSpells.push_back(71491);
6804 RandomSpells.push_back(71485);
6805 break;
6806 default:
6807 return false;
6808 }
6809 if (RandomSpells.empty()) // shouldn't happen
6810 return false;
6811
6812 uint8 rand_spell = irand(0, (RandomSpells.size() - 1));
6813 CastSpell(target, RandomSpells[rand_spell], true, castItem, triggeredByAura, originalCaster);
6814 break;
6815 }
6816 case 71562: // Deathbringer's Will Heroic
6817 {
6818 if (GetTypeId() != TYPEID_PLAYER || HasSpellCooldown(71561))
6819 return false;
6820
6821 AddSpellCooldown(71561, 0, cooldown);
6822
6823 std::vector<uint32> RandomSpells;
6824 switch (getClass())
6825 {
6826 case CLASS_WARRIOR:
6827 case CLASS_PALADIN:
6828 case CLASS_DEATH_KNIGHT:
6829 RandomSpells.push_back(71561);
6830 RandomSpells.push_back(71559);
6831 RandomSpells.push_back(71560);
6832 break;
6833 case CLASS_SHAMAN:
6834 case CLASS_ROGUE:
6835 RandomSpells.push_back(71558);
6836 RandomSpells.push_back(71556);
6837 RandomSpells.push_back(71560);
6838 break;
6839 case CLASS_DRUID:
6840 RandomSpells.push_back(71561);
6841 RandomSpells.push_back(71556);
6842 RandomSpells.push_back(71560);
6843 break;
6844 case CLASS_HUNTER:
6845 RandomSpells.push_back(71558);
6846 RandomSpells.push_back(71559);
6847 RandomSpells.push_back(71556);
6848 break;
6849 default:
6850 return false;
6851 }
6852 if (RandomSpells.empty()) // shouldn't happen
6853 return false;
6854
6855 uint8 rand_spell = irand(0, (RandomSpells.size() - 1));
6856 CastSpell(target, RandomSpells[rand_spell], true, castItem, triggeredByAura, originalCaster);
6857 break;
6858 }
6859 // Freya, Petrified Bark
6860 case 62933:
6861 case 62337:
6862 {
6863 if (!victim)
6864 return false;
6865
6866 int32 dmg = damage;
6867 victim->CastCustomSpell(this, 62379, &dmg, 0, 0, true);
6868 return true;
6869 }
6870 // Trial of the Champion, Earth Shield
6871 case 67534:
6872 {
6873 const int32 dmg = (int32)damage;
6874 CastCustomSpell(this, 67535, &dmg, nullptr, nullptr, true, 0, triggeredByAura, triggeredByAura->GetCasterGUID());
6875 return true;
6876 }
6877 // Trial of the Crusader, Faction Champions, Retaliation
6878 case 65932:
6879 {
6880 // check attack comes not from behind
6881 if (!victim || !HasInArc(M_PI, victim))
6882 return false;
6883
6884 triggered_spell_id = 65934;
6885 break;
6886 }
6887 // Pit of Saron, Tyrannus, Overlord's Brand
6888 case 69172: // everything except for DoTs
6889 {
6890 if (!target)
6891 return false;
6892 if (Unit* caster = triggeredByAura->GetCaster())
6893 {
6895 {
6896 int32 dmg = 5.5f * damage;
6897 target->CastCustomSpell(caster, 69190, &dmg, 0, 0, true);
6898 }
6899 else
6900 {
6901 if (caster->GetVictim())
6902 {
6903 int32 dmg = damage;
6904 target->CastCustomSpell(caster->GetVictim(), 69189, &dmg, 0, 0, true);
6905 }
6906 }
6907 }
6908 return true;
6909 }
6910 // Pit of Saron, Tyrannus, Overlord's Brand
6911 case 69173: // only DoTs
6912 {
6913 if (!target)
6914 return false;
6915 if (Unit* caster = triggeredByAura->GetCaster())
6916 {
6917 if (procEx & PROC_EX_INTERNAL_HOT)
6918 {
6919 int32 dmg = 5.5f * damage;
6920 target->CastCustomSpell(caster, 69190, &dmg, 0, 0, true);
6921 }
6922 else
6923 {
6924 if (caster->GetVictim())
6925 {
6926 int32 dmg = damage;
6927 target->CastCustomSpell(caster->GetVictim(), 69189, &dmg, 0, 0, true);
6928 }
6929 }
6930 }
6931 return true;
6932 }
6933 // Icecrown Citadel, Lady Deathwhisper, Vampiric Might
6934 case 70674:
6935 {
6936 if (Unit* caster = triggeredByAura->GetCaster())
6937 {
6938 int32 dmg = 3 * damage;
6939 caster->CastCustomSpell(caster, 70677, &dmg, 0, 0, true);
6940 }
6941 return true;
6942 }
6943 // Item: Purified Shard of the Gods
6944 case 69755:
6945 {
6946 triggered_spell_id = ((procFlag & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS) ? 69733 : 69729);
6947 break;
6948 }
6949 // Item: Shiny Shard of the Gods
6950 case 69739:
6951 {
6952 triggered_spell_id = ((procFlag & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS) ? 69734 : 69730);
6953 break;
6954 }
6955 // VoA: Meteor Fists koralon
6956 case 66725:
6957 case 68161:
6958 {
6959 triggered_spell_id = 66765; // handled by spell_difficulty
6960 break;
6961 }
6962 }
6963 break;
6964 }
6965 case SPELLFAMILY_MAGE:
6966 {
6967 // Magic Absorption
6968 if (dummySpell->SpellIconID == 459) // only this spell has SpellIconID == 459 and dummy aura
6969 {
6970 if (getPowerType() != POWER_MANA)
6971 return false;
6972
6973 // mana reward
6974 basepoints0 = CalculatePct(int32(GetMaxPower(POWER_MANA)), triggerAmount);
6975 target = this;
6976 triggered_spell_id = 29442;
6977 break;
6978 }
6979 // Hot Streak
6980 if (dummySpell->SpellIconID == 2999)
6981 {
6982 if (effIndex != 0)
6983 return false;
6984 AuraEffect* counter = triggeredByAura->GetBase()->GetEffect(EFFECT_1);
6985 if (!counter)
6986 return true;
6987
6988 // Count spell criticals in a row in second aura
6989 if (procEx & PROC_EX_CRITICAL_HIT)
6990 {
6991 counter->SetAmount(counter->GetAmount() * 2);
6992 if (counter->GetAmount() < 100) // not enough
6993 return true;
6994 // Crititcal counted -> roll chance
6995 if (roll_chance_i(triggerAmount))
6996 CastSpell(this, 48108, true, castItem, triggeredByAura);
6997 }
6998 counter->SetAmount(25);
6999 return true;
7000 }
7001 // Incanter's Regalia set (add trigger chance to Mana Shield)
7002 if (dummySpell->SpellFamilyFlags[0] & 0x8000)
7003 {
7004 if (GetTypeId() != TYPEID_PLAYER)
7005 return false;
7006
7007 target = this;
7008 triggered_spell_id = 37436;
7009 break;
7010 }
7011 switch (dummySpell->Id)
7012 {
7013 // Glyph of Polymorph
7014 case 56375:
7015 {
7016 if (!target)
7017 return false;
7018 target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, ObjectGuid::Empty, target->GetAura(32409)); // SW:D shall not be removed.
7021 return true;
7022 }
7023 // Glyph of Icy Veins
7024 case 56374:
7025 {
7028 return true;
7029 }
7030 // Glyph of Ice Block
7031 case 56372:
7032 {
7033 Player* player = ToPlayer();
7034 if (!player)
7035 return false;
7036
7037 SpellCooldowns const cooldowns = player->GetSpellCooldowns();
7038 // remove cooldowns on all ranks of Frost Nova
7039 for (SpellCooldowns::const_iterator itr = cooldowns.begin(); itr != cooldowns.end(); ++itr)
7040 {
7041 SpellInfo const* cdSpell = sSpellMgr->GetSpellInfo(itr->first);
7042 // Frost Nova
7043 if (cdSpell && cdSpell->SpellFamilyName == SPELLFAMILY_MAGE
7044 && cdSpell->SpellFamilyFlags[0] & 0x00000040)
7045 player->RemoveSpellCooldown(cdSpell->Id, true);
7046 }
7047 break;
7048 }
7049 }
7050 break;
7051 }
7053 {
7054 switch (dummySpell->Id)
7055 {
7056 // Victorious
7057 case 32216:
7058 {
7059 RemoveAura(dummySpell->Id);
7060 return false;
7061 }
7062 }
7063
7064 // Second Wind
7065 if (dummySpell->SpellIconID == 1697)
7066 {
7067 // only for spells and hit/crit (trigger start always) and not start from self casted spells (5530 Mace Stun Effect for example)
7068 if (procSpell == 0 || !(procEx & (PROC_EX_NORMAL_HIT | PROC_EX_CRITICAL_HIT)) || this == victim)
7069 return false;
7070 // Need stun or root mechanic
7071 if (!(procSpell->GetAllEffectsMechanicMask() & ((1 << MECHANIC_ROOT) | (1 << MECHANIC_STUN))))
7072 return false;
7073
7074 switch (dummySpell->Id)
7075 {
7076 case 29838:
7077 triggered_spell_id = 29842;
7078 break;
7079 case 29834:
7080 triggered_spell_id = 29841;
7081 break;
7082 case 42770:
7083 triggered_spell_id = 42771;
7084 break;
7085 default:
7086 LOG_ERROR("entities.unit", "Unit::HandleDummyAuraProc: non handled spell id: {} (SW)", dummySpell->Id);
7087 return false;
7088 }
7089
7090 target = this;
7091 break;
7092 }
7093 break;
7094 }
7096 {
7097 // Seed of Corruption
7098 if (dummySpell->SpellFamilyFlags[1] & 0x00000010)
7099 {
7100 if (procSpell && procSpell->SpellFamilyFlags[1] & 0x8000)
7101 return false;
7102 // if damage is more than need or target die from damage deal finish spell
7103 if (triggeredByAura->GetAmount() <= int32(damage) || GetHealth() <= damage)
7104 {
7105 // remember guid before aura delete
7106 ObjectGuid casterGuid = triggeredByAura->GetCasterGUID();
7107
7108 // Remove aura (before cast for prevent infinite loop handlers)
7109 RemoveAurasDueToSpell(triggeredByAura->GetId());
7110
7111 uint32 spell = sSpellMgr->GetSpellWithRank(27285, dummySpell->GetRank());
7112
7113 // Cast finish spell (triggeredByAura already not exist!)
7114 if (Unit* caster = ObjectAccessor::GetUnit(*this, casterGuid))
7115 {
7116 this->CastSpell(this, 37826, true); // VISUAL!
7117 caster->CastSpell(this, spell, true, castItem);
7118 }
7119
7120 return true; // no hidden cooldown
7121 }
7122
7123 // Damage counting
7124 triggeredByAura->SetAmount(triggeredByAura->GetAmount() - damage);
7125 return true;
7126 }
7127 // Seed of Corruption (Mobs cast) - no die req
7128 if (dummySpell->SpellFamilyFlags.IsEqual(0, 0, 0) && dummySpell->SpellIconID == 1932)
7129 {
7130 // if damage is more than need deal finish spell
7131 if (triggeredByAura->GetAmount() <= int32(damage))
7132 {
7133 // remember guid before aura delete
7134 ObjectGuid casterGuid = triggeredByAura->GetCasterGUID();
7135
7136 // Remove aura (before cast for prevent infinite loop handlers)
7137 RemoveAurasDueToSpell(triggeredByAura->GetId());
7138
7139 // Cast finish spell (triggeredByAura already not exist!)
7140 if (Unit* caster = ObjectAccessor::GetUnit(*this, casterGuid))
7141 {
7142 this->CastSpell(this, 37826, true); // VISUAL!
7143 caster->CastSpell(this, 32865, true, castItem);
7144 }
7145 return true; // no hidden cooldown
7146 }
7147 // Damage counting
7148 triggeredByAura->SetAmount(triggeredByAura->GetAmount() - damage);
7149 return true;
7150 }
7151 switch (dummySpell->Id)
7152 {
7153 // Nightfall
7154 case 18094:
7155 case 18095:
7156 // Glyph of corruption
7157 case 56218:
7158 {
7159 target = this;
7160 triggered_spell_id = 17941;
7161 break;
7162 }
7163 // Soul Leech
7164 case 30293:
7165 case 30295:
7166 case 30296:
7167 {
7168 // Improved Soul Leech
7169 AuraEffectList const& SoulLeechAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY);
7170 for (Unit::AuraEffectList::const_iterator i = SoulLeechAuras.begin(); i != SoulLeechAuras.end(); ++i)
7171 {
7172 if ((*i)->GetId() == 54117 || (*i)->GetId() == 54118)
7173 {
7174 if ((*i)->GetEffIndex() != 0)
7175 continue;
7176 basepoints0 = int32((*i)->GetAmount());
7177 target = GetGuardianPet();
7178 if (target)
7179 {
7180 // regen mana for pet
7181 CastCustomSpell(target, 54607, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura);
7182 }
7183 // regen mana for caster
7184 CastCustomSpell(this, 59117, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura);
7185 // Get second aura of spell for replenishment effect on party
7186 if (AuraEffect const* aurEff = (*i)->GetBase()->GetEffect(EFFECT_1))
7187 {
7188 // Replenishment - roll chance
7189 if (roll_chance_i(aurEff->GetAmount()))
7190 {
7191 CastSpell(this, 57669, true, castItem, triggeredByAura);
7192 }
7193 }
7194 break;
7195 }
7196 }
7197 // health
7198 basepoints0 = CalculatePct(int32(damage), triggerAmount);
7199 target = this;
7200 triggered_spell_id = 30294;
7201 break;
7202 }
7203 // Shadowflame (Voidheart Raiment set bonus)
7204 case 37377:
7205 {
7206 triggered_spell_id = 37379;
7207 break;
7208 }
7209 // Pet Healing (Corruptor Raiment or Rift Stalker Armor)
7210 case 37381:
7211 {
7212 target = GetGuardianPet();
7213 if (!target)
7214 return false;
7215
7216 // heal amount
7217 basepoints0 = CalculatePct(int32(damage), triggerAmount);
7218 triggered_spell_id = 37382;
7219 break;
7220 }
7221 // Shadowflame Hellfire (Voidheart Raiment set bonus)
7222 case 39437:
7223 {
7224 triggered_spell_id = 37378;
7225 break;
7226 }
7227 }
7228 break;
7229 }
7230 case SPELLFAMILY_PRIEST:
7231 {
7232 // Body and Soul
7233 if (dummySpell->SpellIconID == 2218)
7234 {
7235 // Proc only from Abolish desease on self cast
7236 if (procSpell->Id != 552 || victim != this || !roll_chance_i(triggerAmount))
7237 return false;
7238 triggered_spell_id = 64136;
7239 target = this;
7240 break;
7241 }
7242 switch (dummySpell->Id)
7243 {
7244 // Vampiric Embrace
7245 case 15286:
7246 {
7247 if (!victim || !victim->IsAlive() || procSpell->SpellFamilyFlags[1] & 0x80000)
7248 return false;
7249
7250 // heal amount
7251 int32 total = CalculatePct(int32(damage), triggerAmount);
7252 int32 team = total / 5;
7253 int32 self = total - team;
7254 CastCustomSpell(this, 15290, &team, &self, nullptr, true, castItem, triggeredByAura);
7255 return true; // no hidden cooldown
7256 }
7257 // Priest Tier 6 Trinket (Ashtongue Talisman of Acumen)
7258 case 40438:
7259 {
7260 // Shadow Word: Pain
7261 if (procSpell->SpellFamilyFlags[0] & 0x8000)
7262 triggered_spell_id = 40441;
7263 // Renew
7264 else if (procSpell->SpellFamilyFlags[0] & 0x40)
7265 triggered_spell_id = 40440;
7266 else
7267 return false;
7268
7269 target = this;
7270 break;
7271 }
7272 // Improved Shadowform
7273 case 47570:
7274 case 47569:
7275 {
7276 if (!roll_chance_i(triggerAmount))
7277 return false;
7278
7280 break;
7281 }
7282 // Glyph of Dispel Magic
7283 case 55677:
7284 {
7285 // Dispel Magic shares spellfamilyflag with abolish disease
7286 if (procSpell->SpellIconID != 74)
7287 return false;
7288 if (!target || !target->IsFriendlyTo(this))
7289 return false;
7290
7291 basepoints0 = int32(target->CountPctFromMaxHealth(triggerAmount));
7292 triggered_spell_id = 56131;
7293 break;
7294 }
7295 // Oracle Healing Bonus ("Garments of the Oracle" set)
7296 case 26169:
7297 {
7298 // heal amount
7299 basepoints0 = int32(CalculatePct(damage, 10));
7300 target = this;
7301 triggered_spell_id = 26170;
7302 break;
7303 }
7304 // Frozen Shadoweave (Shadow's Embrace set) warning! its not only priest set
7305 case 39372:
7306 {
7307 if (!procSpell || (procSpell->GetSchoolMask() & (SPELL_SCHOOL_MASK_FROST | SPELL_SCHOOL_MASK_SHADOW)) == 0)
7308 return false;
7309
7310 // heal amount
7311 basepoints0 = CalculatePct(int32(damage), triggerAmount);
7312 target = this;
7313 triggered_spell_id = 39373;
7314 break;
7315 }
7316 // Greater Heal (Vestments of Faith (Priest Tier 3) - 4 pieces bonus)
7317 case 28809:
7318 {
7319 triggered_spell_id = 28810;
7320 break;
7321 }
7322 // Priest T10 Healer 2P Bonus
7323 case 70770:
7324 // Flash Heal
7325 if (procSpell->SpellFamilyFlags[0] & 0x800)
7326 {
7327 triggered_spell_id = 70772;
7328 SpellInfo const* blessHealing = sSpellMgr->GetSpellInfo(triggered_spell_id);
7329 if (!blessHealing || !victim)
7330 return false;
7331 basepoints0 = int32(CalculatePct(damage, triggerAmount) / (blessHealing->GetMaxDuration() / blessHealing->Effects[0].Amplitude));
7332 victim->CastDelayedSpellWithPeriodicAmount(this, triggered_spell_id, SPELL_AURA_PERIODIC_HEAL, basepoints0);
7333 return true;
7334 }
7335 break;
7336 }
7337 break;
7338 }
7339 case SPELLFAMILY_DRUID:
7340 {
7341 switch (dummySpell->Id)
7342 {
7343 // Glyph of Innervate
7344 case 54832:
7345 {
7346 if (procSpell->SpellIconID != 62)
7347 return false;
7348
7349 int32 mana_perc = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcValue();
7350 basepoints0 = int32(CalculatePct(GetCreatePowers(POWER_MANA), mana_perc) / 10);
7351 triggered_spell_id = 54833;
7352 target = this;
7353 break;
7354 }
7355 // Glyph of Starfire
7356 case 54845:
7357 {
7358 triggered_spell_id = 54846;
7359 break;
7360 }
7361 // Glyph of Shred
7362 case 54815:
7363 {
7364 if (!target)
7365 return false;
7366
7367 // try to find spell Rip on the target
7368 if (AuraEffect const* AurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x00800000, 0x0, 0x0, GetGUID()))
7369 {
7370 // Rip's max duration, note: spells which modifies Rip's duration also counted like Glyph of Rip
7371 uint32 CountMin = AurEff->GetBase()->GetMaxDuration();
7372
7373 // just Rip's max duration without other spells
7374 uint32 CountMax = AurEff->GetSpellInfo()->GetMaxDuration();
7375
7376 // add possible auras' and Glyph of Shred's max duration
7377 CountMax += 3 * triggerAmount * IN_MILLISECONDS; // Glyph of Shred -> +6 seconds
7378 CountMax += HasAura(54818) ? 4 * IN_MILLISECONDS : 0; // Glyph of Rip -> +4 seconds
7379 CountMax += HasAura(60141) ? 4 * IN_MILLISECONDS : 0; // Rip Duration/Lacerate Damage -> +4 seconds
7380
7381 // if min < max -> that means caster didn't cast 3 shred yet
7382 // so set Rip's duration and max duration
7383 if (CountMin < CountMax)
7384 {
7385 AurEff->GetBase()->SetDuration(AurEff->GetBase()->GetDuration() + triggerAmount * IN_MILLISECONDS);
7386 AurEff->GetBase()->SetMaxDuration(CountMin + triggerAmount * IN_MILLISECONDS);
7387 return true;
7388 }
7389 }
7390 // if not found Rip
7391 return false;
7392 }
7393 // Glyph of Rake
7394 case 54821:
7395 {
7396 if (procSpell->SpellVisual[0] == 750 && procSpell->Effects[1].ApplyAuraName == 3)
7397 {
7398 if (target && target->GetTypeId() == TYPEID_UNIT)
7399 {
7400 triggered_spell_id = 54820;
7401 break;
7402 }
7403 }
7404 return false;
7405 }
7406 // Leader of the Pack
7407 case 24932:
7408 {
7409 if (triggerAmount <= 0)
7410 return false;
7411 basepoints0 = int32(CountPctFromMaxHealth(triggerAmount));
7412 target = this;
7413 triggered_spell_id = 34299;
7414 if (triggeredByAura->GetCasterGUID() != GetGUID())
7415 break;
7416 int32 basepoints1 = CalculatePct(GetMaxPower(Powers(POWER_MANA)), triggerAmount * 2);
7417 // Improved Leader of the Pack
7418 // Check cooldown of heal spell cooldown
7419 if (GetTypeId() == TYPEID_PLAYER && !ToPlayer()->HasSpellCooldown(34299))
7420 CastCustomSpell(this, 68285, &basepoints1, 0, 0, true, 0, triggeredByAura);
7421 break;
7422 }
7423 // Healing Touch (Dreamwalker Raiment set)
7424 case 28719:
7425 {
7426 // mana back
7427 basepoints0 = int32(CalculatePct(spellProc->GetPowerCost(), 30));
7428 target = this;
7429 triggered_spell_id = 28742;
7430 break;
7431 }
7432 // Glyph of Rejuvenation
7433 case 54754:
7434 {
7435 if (!victim || !victim->HealthBelowPct(uint32(triggerAmount)))
7436 return false;
7437 basepoints0 = CalculatePct(int32(damage), triggerAmount);
7438 triggered_spell_id = 54755;
7439 break;
7440 }
7441 // Healing Touch Refund (Idol of Longevity trinket)
7442 case 28847:
7443 {
7444 target = this;
7445 triggered_spell_id = 28848;
7446 break;
7447 }
7448 // Mana Restore (Malorne Raiment set / Malorne Regalia set)
7449 case 37288:
7450 case 37295:
7451 {
7452 target = this;
7453 triggered_spell_id = 37238;
7454 break;
7455 }
7456 // Druid Tier 6 Trinket
7457 case 40442:
7458 {
7459 float chance;
7460
7461 // Starfire
7462 if (procSpell->SpellFamilyFlags[0] & 0x4)
7463 {
7464 triggered_spell_id = 40445;
7465 chance = 25.0f;
7466 }
7467 // Rejuvenation
7468 else if (procSpell->SpellFamilyFlags[0] & 0x10)
7469 {
7470 triggered_spell_id = 40446;
7471 chance = 25.0f;
7472 }
7473 // Mangle (Bear) and Mangle (Cat)
7474 else if (procSpell->SpellFamilyFlags[1] & 0x00000440)
7475 {
7476 triggered_spell_id = 40452;
7477 chance = 40.0f;
7478 }
7479 else
7480 return false;
7481
7482 if (!roll_chance_f(chance))
7483 return false;
7484
7485 target = this;
7486 break;
7487 }
7488 // Maim Interrupt
7489 case 44835:
7490 {
7491 // Deadly Interrupt Effect
7492 triggered_spell_id = 32747;
7493 break;
7494 }
7495 // Item - Druid T10 Restoration 4P Bonus (Rejuvenation)
7496 case 70664:
7497 {
7498 // xinef: proc only from normal Rejuvenation, and proc rejuvenation
7499 if (!victim || !procSpell || procSpell->SpellIconID != 64)
7500 return false;
7501
7502 Player* caster = ToPlayer();
7503 if (!caster)
7504 return false;
7505 if (!caster->GetGroup() && victim == this)
7506 return false;
7507
7508 CastCustomSpell(70691, SPELLVALUE_BASE_POINT0, damage, victim, true);
7509 return true;
7510 }
7511 }
7512 // Eclipse
7513 if (dummySpell->SpellIconID == 2856 && GetTypeId() == TYPEID_PLAYER)
7514 {
7515 if (!procSpell || effIndex != 0)
7516 return false;
7517
7518 bool isWrathSpell = (procSpell->SpellFamilyFlags[0] & 1);
7519
7520 if (!roll_chance_f(dummySpell->ProcChance * (isWrathSpell ? 0.6f : 1.0f)))
7521 return false;
7522
7523 target = this;
7524 if (target->HasAura(isWrathSpell ? 48517 : 48518))
7525 return false;
7526
7527 triggered_spell_id = isWrathSpell ? 48518 : 48517;
7528 break;
7529 }
7530 [[fallthrough]]; // TODO: Not sure whether the fallthrough was a mistake (forgetting a break) or intended. This should be double-checked.
7531 }
7532 case SPELLFAMILY_ROGUE:
7533 {
7534 switch(dummySpell->Id)
7535 {
7536 // Glyph of Backstab
7537 case 56800:
7538 {
7539 if (victim)
7540 if (AuraEffect* aurEff = victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x100000, 0, 0, GetGUID()))
7541 if (Aura* aur = aurEff->GetBase())
7542 if (!aur->IsRemoved() && aur->GetDuration() > 0)
7543 if ((aur->GetApplyTime() + aur->GetMaxDuration() / 1000 + 5) > (GameTime::GetGameTime().count() + aur->GetDuration() / 1000) )
7544 {
7545 aur->SetDuration(aur->GetDuration() + 2000);
7546 return true;
7547 }
7548 return false;
7549 }
7550 // Deadly Throw Interrupt
7551 case 32748:
7552 {
7553 // Prevent cast Deadly Throw Interrupt on self from last effect (apply dummy) of Deadly Throw
7554 if (this == victim)
7555 return false;
7556
7557 triggered_spell_id = 32747;
7558 break;
7559 }
7560 }
7561 // Master of subtlety
7562 if( dummySpell->SpellIconID == 2114 )
7563 {
7564 triggered_spell_id = 31665;
7565 basepoints0 = triggerAmount;
7566 break;
7567 }
7568 // Cut to the Chase
7569 if (dummySpell->SpellIconID == 2909)
7570 {
7571 // "refresh your Slice and Dice duration to its 5 combo point maximum"
7572 // lookup Slice and Dice
7573 if (AuraEffect const* aur = GetAuraEffect(SPELL_AURA_MOD_MELEE_HASTE, SPELLFAMILY_ROGUE, 0x40000, 0, 0))
7574 {
7575 aur->GetBase()->SetDuration(aur->GetSpellInfo()->GetMaxDuration(), true);
7576 return true;
7577 }
7578 return false;
7579 }
7580 // Deadly Brew
7581 else if (dummySpell->SpellIconID == 2963)
7582 {
7583 triggered_spell_id = 3409;
7584 break;
7585 }
7586 // Quick Recovery
7587 else if (dummySpell->SpellIconID == 2116)
7588 {
7589 if (!procSpell)
7590 return false;
7591
7592 // energy cost save
7593 basepoints0 = CalculatePct(int32(procSpell->ManaCost), triggerAmount);
7594 if (basepoints0 <= 0)
7595 return false;
7596
7597 target = this;
7598 triggered_spell_id = 31663;
7599 break;
7600 }
7601 break;
7602 }
7603 case SPELLFAMILY_HUNTER:
7604 {
7605 switch (dummySpell->SpellIconID)
7606 {
7607 case 2236: // Thrill of the Hunt
7608 {
7609 if (!procSpell)
7610 return false;
7611
7613
7614 // Disable charge drop because of Lock and Load
7615 if (spell)
7616 ToPlayer()->SetSpellModTakingSpell(spell, false);
7617
7618 // Explosive Shot
7619 if (procSpell->SpellFamilyFlags[2] & 0x200)
7620 {
7621 if (!victim)
7622 return false;
7623 if (AuraEffect const* pEff = victim->GetAuraEffect(SPELL_AURA_PERIODIC_DUMMY, SPELLFAMILY_HUNTER, 0x0, 0x80000000, 0x0, GetGUID()))
7624 basepoints0 = pEff->GetSpellInfo()->CalcPowerCost(this, SpellSchoolMask(pEff->GetSpellInfo()->SchoolMask)) * 4 / 10 / 3;
7625 }
7626 else
7627 basepoints0 = procSpell->CalcPowerCost(this, SpellSchoolMask(procSpell->SchoolMask)) * 4 / 10;
7628
7629 if (spell)
7630 ToPlayer()->SetSpellModTakingSpell(spell, true);
7631
7632 if (basepoints0 <= 0)
7633 return false;
7634
7635 target = this;
7636 triggered_spell_id = 34720;
7637 break;
7638 }
7639 case 3406: // Hunting Party
7640 {
7641 triggered_spell_id = 57669;
7642 target = this;
7643 break;
7644 }
7645 case 3560: // Rapid Recuperation
7646 {
7647 // This effect only from Rapid Killing (mana regen)
7648 if (!(procSpell->SpellFamilyFlags[1] & 0x01000000))
7649 return false;
7650
7651 target = this;
7652
7653 switch (dummySpell->Id)
7654 {
7655 case 53228: // Rank 1
7656 triggered_spell_id = 56654;
7657 break;
7658 case 53232: // Rank 2
7659 triggered_spell_id = 58882;
7660 break;
7661 }
7662 break;
7663 }
7664 }
7665
7666 switch (dummySpell->Id)
7667 {
7668 case 57870: // Glyph of Mend Pet
7669 {
7670 if (!victim)
7671 return false;
7672
7673 victim->CastSpell(victim, 57894, true, nullptr, nullptr, GetGUID());
7674 return true;
7675 }
7676 }
7677 break;
7678 }
7680 {
7681 // Light's Beacon - Beacon of Light
7682 if (dummySpell->Id == 53651)
7683 {
7684 if (!victim)
7685 return false;
7686
7687 // Do not proc from Glyph of Holy Light and Judgement of Light
7688 if (procSpell->Id == 20267 || procSpell->Id == 54968)
7689 {
7690 return false;
7691 }
7692
7693 Unit* beaconTarget = triggeredByAura->GetBase()->GetCaster();
7694 if (!beaconTarget || beaconTarget == this || !beaconTarget->GetAura(53563, victim->GetGUID()))
7695 return false;
7696
7697 basepoints0 = int32(damage);
7698 triggered_spell_id = procSpell->IsRankOf(sSpellMgr->GetSpellInfo(635)) ? 53652 : 53654;
7699
7700 victim->CastCustomSpell(beaconTarget, triggered_spell_id, &basepoints0, nullptr, nullptr, true, 0, triggeredByAura, victim->GetGUID());
7701 return true;
7702 }
7703 // Judgements of the Wise
7704 if (dummySpell->SpellIconID == 3017)
7705 {
7706 target = this;
7707 triggered_spell_id = 31930;
7708 // replenishment
7709 CastSpell(this, 57669, true, castItem, triggeredByAura);
7710 break;
7711 }
7712 // Righteous Vengeance
7713 if (dummySpell->SpellIconID == 3025)
7714 {
7715 if (!victim)
7716 return false;
7717
7718 // 4 damage tick
7719 basepoints0 = triggerAmount * damage / 400;
7720 triggered_spell_id = 61840;
7721 // Add remaining ticks to damage done
7722 victim->CastDelayedSpellWithPeriodicAmount(this, triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE, basepoints0);
7723 return true;
7724 }
7725 // Sheath of Light
7726 if (dummySpell->SpellIconID == 3030)
7727 {
7728 // 4 healing tick
7729 basepoints0 = triggerAmount * damage / 400;
7730 triggered_spell_id = 54203;
7731 break;
7732 }
7733 switch (dummySpell->Id)
7734 {
7735 // Judgement of Light
7736 case 20185:
7737 {
7738 if (!victim || !victim->IsAlive() || victim->HasSpellCooldown(20267))
7739 return false;
7740 // 2% of base mana
7741 basepoints0 = int32(victim->CountPctFromMaxHealth(2));
7742 victim->CastCustomSpell(victim, 20267, &basepoints0, 0, 0, true, 0, triggeredByAura);
7743 victim->AddSpellCooldown(20267, 0, 4 * IN_MILLISECONDS);
7744 return true;
7745 }
7746 // Judgement of Wisdom
7747 case 20186:
7748 {
7749 if (!victim || !victim->IsAlive() || victim->getPowerType() != POWER_MANA || victim->HasSpellCooldown(20268))
7750 return false;
7751
7752 // 2% of base mana
7753 basepoints0 = int32(CalculatePct(victim->GetCreateMana(), 2));
7754 victim->CastCustomSpell(victim, 20268, &basepoints0, nullptr, nullptr, true, 0, triggeredByAura);
7755 victim->AddSpellCooldown(20268, 0, 4 * IN_MILLISECONDS);
7756 return true;
7757 }
7758 // Holy Power (Redemption Armor set)
7759 case 28789:
7760 {
7761 if (!victim)
7762 return false;
7763
7764 // Set class defined buff
7765 switch (victim->getClass())
7766 {
7767 case CLASS_PALADIN:
7768 case CLASS_PRIEST:
7769 case CLASS_SHAMAN:
7770 case CLASS_DRUID:
7771 triggered_spell_id = 28795; // Increases the friendly target's mana regeneration by $s1 per 5 sec. for $d.
7772 break;
7773 case CLASS_MAGE:
7774 case CLASS_WARLOCK:
7775 triggered_spell_id = 28793; // Increases the friendly target's spell damage and healing by up to $s1 for $d.
7776 break;
7777 case CLASS_HUNTER:
7778 case CLASS_ROGUE:
7779 triggered_spell_id = 28791; // Increases the friendly target's attack power by $s1 for $d.
7780 break;
7781 case CLASS_WARRIOR:
7782 triggered_spell_id = 28790; // Increases the friendly target's armor
7783 break;
7784 default:
7785 return false;
7786 }
7787 break;
7788 }
7789 // Seal of Vengeance (damage calc on apply aura)
7790 case 31801:
7791 {
7792 if (effIndex != 0 || !victim) // effect 1, 2 used by seal unleashing code
7793 return false;
7794
7795 // At melee attack or Hammer of the Righteous spell damage considered as melee attack
7796 bool stacker = !procSpell || procSpell->Id == 53595;
7797 // spells with SPELL_DAMAGE_CLASS_MELEE excluding Judgements
7798 bool damager = procSpell && (procSpell->EquippedItemClass != -1 || (procSpell->SpellIconID == 243 && procSpell->SpellVisual[0] == 39));
7799
7800 if (!stacker && !damager)
7801 return false;
7802
7803 triggered_spell_id = 31803;
7804
7805 // On target with 5 stacks of Holy Vengeance direct damage is done
7806 if (Aura* aur = victim->GetAura(triggered_spell_id, GetGUID()))
7807 {
7808 if (aur->GetStackAmount() == 5)
7809 {
7810 if (stacker)
7811 aur->RefreshDuration();
7812
7813 CastSpell(victim, 42463, true, castItem, triggeredByAura);
7814 return true;
7815 }
7816 }
7817
7818 if (!stacker)
7819 return false;
7820 break;
7821 }
7822 // Seal of Corruption
7823 case 53736:
7824 {
7825 if (effIndex != 0 || !victim) // effect 1, 2 used by seal unleashing code
7826 return false;
7827
7828 // At melee attack or Hammer of the Righteous spell damage considered as melee attack
7829 bool stacker = !procSpell || procSpell->Id == 53595;
7830 // spells with SPELL_DAMAGE_CLASS_MELEE excluding Judgements
7831 bool damager = procSpell && (procSpell->EquippedItemClass != -1 || (procSpell->SpellIconID == 243 && procSpell->SpellVisual[0] == 39));
7832
7833 if (!stacker && !damager)
7834 return false;
7835
7836 triggered_spell_id = 53742;
7837
7838 // On target with 5 stacks of Blood Corruption direct damage is done
7839 if (Aura* aur = victim->GetAura(triggered_spell_id, GetGUID()))
7840 {
7841 if (aur->GetStackAmount() == 5)
7842 {
7843 if (stacker)
7844 aur->RefreshDuration();
7845
7846 CastSpell(victim, 53739, true, castItem, triggeredByAura);
7847 return true;
7848 }
7849 }
7850
7851 if (!stacker)
7852 return false;
7853 break;
7854 }
7855 // Spiritual Attunement
7856 case 31785:
7857 case 33776:
7858 {
7859 // if healed by another unit (victim)
7860 if (this == victim)
7861 return false;
7862
7863 // dont allow non-positive dots to proc
7864 if (!procSpell || !procSpell->IsPositive())
7865 return false;
7866
7867 // heal amount
7868 basepoints0 = int32(CalculatePct(std::min(damage, GetMaxHealth() - GetHealth()), triggerAmount));
7869 target = this;
7870
7871 if (basepoints0)
7872 triggered_spell_id = 31786;
7873 break;
7874 }
7875 // Paladin Tier 6 Trinket (Ashtongue Talisman of Zeal)
7876 case 40470:
7877 {
7878 if (!procSpell)
7879 return false;
7880
7881 float chance = 0.0f;
7882
7883 // Flash of light/Holy light
7884 if (procSpell->SpellFamilyFlags[0] & 0xC0000000)
7885 {
7886 triggered_spell_id = 40471;
7887 chance = 15.0f;
7888 }
7889 // Judgement (any)
7890 else if (procSpell->SpellFamilyFlags[0] & 0x800000)
7891 {
7892 triggered_spell_id = 40472;
7893 chance = 50.0f;
7894 }
7895 else
7896 return false;
7897
7898 if (!roll_chance_f(chance))
7899 return false;
7900
7901 break;
7902 }
7903 // Glyph of Holy Light
7904 case 54937:
7905 {
7906 triggered_spell_id = 54968;
7907 basepoints0 = CalculatePct(int32(damage), triggerAmount);
7908 break;
7909 }
7910 // Item - Paladin T8 Holy 2P Bonus
7911 case 64890:
7912 {
7913 triggered_spell_id = 64891;
7914 basepoints0 = triggerAmount * damage / 300;
7915 break;
7916 }
7917 case 71406: // Tiny Abomination in a Jar
7918 case 71545: // Tiny Abomination in a Jar (Heroic)
7919 {
7920 if (!victim || !victim->IsAlive())
7921 return false;
7922
7923 CastSpell(this, 71432, true, nullptr, triggeredByAura);
7924
7925 Aura const* dummy = GetAura(71432);
7926 if (!dummy || dummy->GetStackAmount() < (dummySpell->Id == 71406 ? 8 : 7))
7927 return false;
7928
7929 RemoveAurasDueToSpell(71432);
7930 triggered_spell_id = 71433; // default main hand attack
7931 // roll if offhand
7932 if (Player const* player = ToPlayer())
7933 if (player->GetWeaponForAttack(OFF_ATTACK, true) && urand(0, 1))
7934 triggered_spell_id = 71434;
7935 target = victim;
7936 break;
7937 }
7938 // Item - Icecrown 25 Normal Dagger Proc
7939 case 71880:
7940 {
7941 switch (getPowerType())
7942 {
7943 case POWER_MANA:
7944 triggered_spell_id = 71881;
7945 break;
7946 case POWER_RAGE:
7947 triggered_spell_id = 71883;
7948 break;
7949 case POWER_ENERGY:
7950 triggered_spell_id = 71882;
7951 break;
7952 case POWER_RUNIC_POWER:
7953 triggered_spell_id = 71884;
7954 break;
7955 default:
7956 return false;
7957 }
7958 break;
7959 }
7960 // Item - Icecrown 25 Heroic Dagger Proc
7961 case 71892:
7962 {
7963 switch (getPowerType())
7964 {
7965 case POWER_MANA:
7966 triggered_spell_id = 71888;
7967 break;
7968 case POWER_RAGE:
7969 triggered_spell_id = 71886;
7970 break;
7971 case POWER_ENERGY:
7972 triggered_spell_id = 71887;
7973 break;
7974 case POWER_RUNIC_POWER:
7975 triggered_spell_id = 71885;
7976 break;
7977 default:
7978 return false;
7979 }
7980 break;
7981 }
7982 }
7983 break;
7984 }
7985 case SPELLFAMILY_SHAMAN:
7986 {
7987 switch (dummySpell->Id)
7988 {
7989 // Tidal Force
7990 case 55198:
7991 {
7992 // Remove aura stack from caster
7993 RemoveAuraFromStack(55166);
7994 // drop charges
7995 return false;
7996 }
7997 // Totemic Power (The Earthshatterer set)
7998 case 28823:
7999 {
8000 if (!victim)
8001 return false;
8002
8003 // Set class defined buff
8004 switch (victim->getClass())
8005 {
8006 case CLASS_PALADIN:
8007 case CLASS_PRIEST:
8008 case CLASS_SHAMAN:
8009 case CLASS_DRUID:
8010 triggered_spell_id = 28824; // Increases the friendly target's mana regeneration by $s1 per 5 sec. for $d.
8011 break;
8012 case CLASS_MAGE:
8013 case CLASS_WARLOCK:
8014 triggered_spell_id = 28825; // Increases the friendly target's spell damage and healing by up to $s1 for $d.
8015 break;
8016 case CLASS_HUNTER:
8017 case CLASS_ROGUE:
8018 triggered_spell_id = 28826; // Increases the friendly target's attack power by $s1 for $d.
8019 break;
8020 case CLASS_WARRIOR:
8021 triggered_spell_id = 28827; // Increases the friendly target's armor
8022 break;
8023 default:
8024 return false;
8025 }
8026 break;
8027 }
8028 // Lesser Healing Wave (Totem of Flowing Water Relic)
8029 case 28849:
8030 {
8031 target = this;
8032 triggered_spell_id = 28850;
8033 break;
8034 }
8035 // Windfury Weapon (Passive) 1-8 Ranks
8036 case 33757:
8037 {
8038 Player* player = ToPlayer();
8039 if (!player || !castItem || !castItem->IsEquipped() || !victim || !victim->IsAlive())
8040 return false;
8041
8042 if (triggeredByAura->GetBase() && castItem->GetGUID() != triggeredByAura->GetBase()->GetCastItemGUID())
8043 return false;
8044
8045 WeaponAttackType attType = WeaponAttackType(player->GetAttackBySlot(castItem->GetSlot()));
8046 if ((attType != BASE_ATTACK && attType != OFF_ATTACK)
8047 || (attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK)
8048 || (attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK))
8049 return false;
8050
8051 // Now amount of extra power stored in 1 effect of Enchant spell
8052 // Get it by item enchant id
8053 uint32 spellId;
8055 {
8056 case 283:
8057 spellId = 8232;
8058 break; // 1 Rank
8059 case 284:
8060 spellId = 8235;
8061 break; // 2 Rank
8062 case 525:
8063 spellId = 10486;
8064 break; // 3 Rank
8065 case 1669:
8066 spellId = 16362;
8067 break; // 4 Rank
8068 case 2636:
8069 spellId = 25505;
8070 break; // 5 Rank
8071 case 3785:
8072 spellId = 58801;
8073 break; // 6 Rank
8074 case 3786:
8075 spellId = 58803;
8076 break; // 7 Rank
8077 case 3787:
8078 spellId = 58804;
8079 break; // 8 Rank
8080 default:
8081 {
8082 LOG_ERROR("entities.unit", "Unit::HandleDummyAuraProc: non handled item enchantment (rank?) {} for spell id: {} (Windfury)",
8083 castItem->GetEnchantmentId(EnchantmentSlot(TEMP_ENCHANTMENT_SLOT)), dummySpell->Id);
8084 return false;
8085 }
8086 }
8087
8088 SpellInfo const* windfurySpellInfo = sSpellMgr->GetSpellInfo(spellId);
8089 if (!windfurySpellInfo)
8090 {
8091 LOG_ERROR("entities.unit", "Unit::HandleDummyAuraProc: non-existing spell id: {} (Windfury)", spellId);
8092 return false;
8093 }
8094
8095 int32 extra_attack_power = CalculateSpellDamage(victim, windfurySpellInfo, 1);
8096
8097 // Value gained from additional AP
8098 basepoints0 = int32(extra_attack_power / 14.0f * GetAttackTime(attType) / 1000);
8099
8100 if (procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK)
8101 triggered_spell_id = 25504;
8102
8103 if (procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK)
8104 triggered_spell_id = 33750;
8105
8106 // custom cooldown processing case
8107 if (player->HasSpellCooldown(dummySpell->Id))
8108 return false;
8109
8110 // apply cooldown before cast to prevent processing itself
8111 player->AddSpellCooldown(dummySpell->Id, 0, 3 * IN_MILLISECONDS);
8112
8113 // Attack Twice
8114 for (uint32 i = 0; i < 2; ++i)
8115 CastCustomSpell(victim, triggered_spell_id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura);
8116
8117 return true;
8118 }
8119 // Shaman Tier 6 Trinket
8120 case 40463:
8121 {
8122 if (!procSpell)
8123 return false;
8124
8125 float chance;
8126 if (procSpell->SpellFamilyFlags[0] & 0x1)
8127 {
8128 triggered_spell_id = 40465; // Lightning Bolt
8129 chance = 15.0f;
8130 }
8131 else if (procSpell->SpellFamilyFlags[0] & 0x80)
8132 {
8133 triggered_spell_id = 40465; // Lesser Healing Wave
8134 chance = 10.0f;
8135 }
8136 else if (procSpell->SpellFamilyFlags[1] & 0x00000010)
8137 {
8138 triggered_spell_id = 40466; // Stormstrike
8139 chance = 50.0f;
8140 }
8141 else
8142 return false;
8143
8144 if (!roll_chance_f(chance))
8145 return false;
8146
8147 target = this;
8148 break;
8149 }
8150 // Glyph of Healing Wave
8151 case 55440:
8152 {
8153 // Not proc from self heals
8154 if (this == victim)
8155 return false;
8156 basepoints0 = CalculatePct(int32(damage), triggerAmount);
8157 target = this;
8158 triggered_spell_id = 55533;
8159 break;
8160 }
8161 // Spirit Hunt
8162 case 58877:
8163 {
8164 // Cast on owner
8165 target = GetOwner();
8166 if (!target)
8167 return false;
8168 basepoints0 = CalculatePct(int32(damage), triggerAmount);
8169 triggered_spell_id = 58879;
8170 // Heal wolf
8171 CastCustomSpell(this, triggered_spell_id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura, originalCaster);
8172 break;
8173 }
8174 // Shaman T8 Elemental 4P Bonus
8175 case 64928:
8176 {
8177 basepoints0 = CalculatePct(int32(damage), triggerAmount);
8178 triggered_spell_id = 64930; // Electrified
8179 break;
8180 }
8181 // Shaman T9 Elemental 4P Bonus
8182 case 67228:
8183 {
8184 // Lava Burst
8185 if (procSpell->SpellFamilyFlags[1] & 0x1000)
8186 {
8187 triggered_spell_id = 71824;
8188 SpellInfo const* triggeredSpell = sSpellMgr->GetSpellInfo(triggered_spell_id);
8189 if (!triggeredSpell)
8190 return false;
8191 basepoints0 = CalculatePct(int32(damage), triggerAmount) / (triggeredSpell->GetMaxDuration() / triggeredSpell->Effects[0].Amplitude);
8192 }
8193 break;
8194 }
8195 // Item - Shaman T10 Elemental 4P Bonus
8196 case 70817:
8197 {
8198 if (!target)
8199 return false;
8200 // try to find spell Flame Shock on the target
8201 if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 0x10000000, 0x0, 0x0, GetGUID()))
8202 {
8203 Aura* flameShock = aurEff->GetBase();
8204 int32 extraTime = 2 * aurEff->GetAmplitude();
8205 flameShock->SetMaxDuration(flameShock->GetMaxDuration() + extraTime);
8206 flameShock->SetDuration(flameShock->GetDuration() + extraTime);
8207
8208 return true;
8209 }
8210 // if not found Flame Shock
8211 return false;
8212 }
8213 break;
8214 }
8215 // Frozen Power
8216 if (dummySpell->SpellIconID == 3780)
8217 {
8218 if (!target)
8219 return false;
8220 if (GetDistance(target) < 15.0f)
8221 return false;
8222 float chance = (float)triggerAmount;
8223 if (!roll_chance_f(chance))
8224 return false;
8225
8226 triggered_spell_id = 63685;
8227 break;
8228 }
8229 // Ancestral Awakening
8230 if (dummySpell->SpellIconID == 3065)
8231 {
8232 triggered_spell_id = 52759;
8233 basepoints0 = CalculatePct(int32(damage), triggerAmount);
8234 target = this;
8235 break;
8236 }
8237 // Flametongue Weapon (Passive)
8238 if (dummySpell->SpellFamilyFlags[0] & 0x200000)
8239 {
8240 if (GetTypeId() != TYPEID_PLAYER || !victim || !victim->IsAlive() || !castItem || !castItem->IsEquipped())
8241 return false;
8242
8244 if ((attType != BASE_ATTACK && attType != OFF_ATTACK)
8245 || (attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK)
8246 || (attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK))
8247 return false;
8248
8249 float fire_onhit = float(CalculatePct(dummySpell->Effects[EFFECT_0]. CalcValue(), 1.0f));
8250
8251 float add_spellpower = (float)(SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE)
8253
8254 // 1.3speed = 5%, 2.6speed = 10%, 4.0 speed = 15%, so, 1.0speed = 3.84%
8255 ApplyPct(add_spellpower, 3.84f);
8256
8257 // Enchant on Off-Hand and ready?
8258 if (castItem->GetSlot() == EQUIPMENT_SLOT_OFFHAND && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK)
8259 {
8260 float BaseWeaponSpeed = GetAttackTime(OFF_ATTACK) / 1000.0f;
8261
8262 // Value1: add the tooltip damage by swingspeed + Value2: add spelldmg by swingspeed
8263 basepoints0 = int32((fire_onhit * BaseWeaponSpeed) + (add_spellpower * BaseWeaponSpeed));
8264 triggered_spell_id = 10444;
8265 }
8266
8267 // Enchant on Main-Hand and ready?
8268 else if (castItem->GetSlot() == EQUIPMENT_SLOT_MAINHAND && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK)
8269 {
8270 float BaseWeaponSpeed = GetAttackTime(BASE_ATTACK) / 1000.0f;
8271
8272 // Value1: add the tooltip damage by swingspeed + Value2: add spelldmg by swingspeed
8273 basepoints0 = int32((fire_onhit * BaseWeaponSpeed) + (add_spellpower * BaseWeaponSpeed));
8274 triggered_spell_id = 10444;
8275 }
8276
8277 // If not ready, we should return, shouldn't we?!
8278 else
8279 return false;
8280
8281 CastCustomSpell(victim, triggered_spell_id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura);
8282 return true;
8283 }
8284 // Improved Water Shield
8285 if (dummySpell->SpellIconID == 2287)
8286 {
8287 if (!procSpell)
8288 return false;
8289
8290 // Default chance for Healing Wave and Riptide
8291 float chance = (float)triggeredByAura->GetAmount();
8292
8293 if (procSpell->SpellFamilyFlags[0] & 0x80)
8294 // Lesser Healing Wave - 0.6 of default
8295 chance *= 0.6f;
8296 else if (procSpell->SpellFamilyFlags[0] & 0x100)
8297 // Chain heal - 0.3 of default
8298 chance *= 0.3f;
8299
8300 if (!roll_chance_f(chance))
8301 return false;
8302
8303 // Water Shield
8304 if (AuraEffect const* aurEff = GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, 0, 0x00000020, 0))
8305 {
8306 uint32 spell = aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
8307 CastSpell(this, spell, true, castItem, triggeredByAura);
8308 return true;
8309 }
8310 return false;
8311 }
8312 // Lightning Overload
8313 if (dummySpell->SpellIconID == 2018) // only this spell have SpellFamily Shaman SpellIconID == 2018 and dummy aura
8314 {
8315 if(!procSpell || GetTypeId() != TYPEID_PLAYER || !victim)
8316 return false;
8317
8318 if (procEx & PROC_EX_CRITICAL_HIT)
8319 damage /= 2;
8320
8321 do
8322 {
8323 uint32 spell = 0;
8324
8325 if (procSpell->SpellFamilyFlags[0] & 0x2)
8326 {
8327 // 1/3 of 33% if 11%
8328 if (!roll_chance_i(33))
8329 return false;
8330
8331 spell = 45297;
8332 }
8333 else
8334 spell = 45284;
8335
8336 // do not reduce damage-spells have correct basepoints
8337 damage /= 2;
8338 int32 dmg = damage;
8339
8340 // Cast
8341 CastCustomSpell(victim, spell, &dmg, 0, 0, true, castItem, triggeredByAura);
8342 } while (roll_chance_i(33));
8343 return true;
8344 }
8345 // Static Shock
8346 if (dummySpell->SpellIconID == 3059)
8347 {
8348 // Lightning Shield
8350 {
8351 uint32 spell = sSpellMgr->GetSpellWithRank(26364, aurEff->GetSpellInfo()->GetRank());
8352 CastSpell(target, spell, true, castItem, triggeredByAura);
8353 aurEff->GetBase()->DropCharge();
8354 return true;
8355 }
8356 return false;
8357 }
8358 break;
8359 }
8361 {
8362 // Improved Blood Presence
8363 if (dummySpell->SpellIconID == 2636)
8364 {
8365 if (GetTypeId() != TYPEID_PLAYER)
8366 return false;
8367 basepoints0 = CalculatePct(int32(damage), triggerAmount);
8368 break;
8369 }
8370 // Butchery
8371 if (dummySpell->SpellIconID == 2664)
8372 {
8373 basepoints0 = triggerAmount;
8374 triggered_spell_id = 50163;
8375 target = this;
8376 break;
8377 }
8378 // Mark of Blood
8379 if (dummySpell->Id == 49005)
8380 {
8381 // TODO: need more info (cooldowns/PPM)
8382 triggered_spell_id = 61607;
8383 break;
8384 }
8385 // Unholy Blight
8386 if (dummySpell->Id == 49194)
8387 {
8388 triggered_spell_id = 50536;
8389 SpellInfo const* unholyBlight = sSpellMgr->GetSpellInfo(triggered_spell_id);
8390 if (!unholyBlight || !victim)
8391 return false;
8392
8393 basepoints0 = CalculatePct(int32(damage), triggerAmount);
8394
8395 //Glyph of Unholy Blight
8396 if (AuraEffect* glyph = GetAuraEffect(63332, 0))
8397 AddPct(basepoints0, glyph->GetAmount());
8398
8399 basepoints0 = basepoints0 / (unholyBlight->GetMaxDuration() / unholyBlight->Effects[0].Amplitude);
8400 victim->CastDelayedSpellWithPeriodicAmount(this, triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE, basepoints0);
8401 return true;
8402 }
8403 // Vendetta
8404 if (dummySpell->SpellFamilyFlags[0] & 0x10000)
8405 {
8406 basepoints0 = int32(CountPctFromMaxHealth(triggerAmount));
8407 triggered_spell_id = 50181;
8408 target = this;
8409 break;
8410 }
8411 // Necrosis
8412 if (dummySpell->SpellIconID == 2709)
8413 {
8414 basepoints0 = CalculatePct(int32(damage), triggerAmount);
8415 triggered_spell_id = 51460;
8416 break;
8417 }
8418 // Threat of Thassarian
8419 if (dummySpell->SpellIconID == 2023)
8420 {
8421 // Must Dual Wield
8422 if (!procSpell || !haveOffhandWeapon())
8423 return false;
8424 // Chance as basepoints for dummy aura
8425 if (!roll_chance_i(triggerAmount))
8426 return false;
8427
8428 switch (procSpell->Id)
8429 {
8430 // Obliterate
8431 case 49020:
8432 triggered_spell_id = 66198;
8433 break; // Rank 1
8434 case 51423:
8435 triggered_spell_id = 66972;
8436 break; // Rank 2
8437 case 51424:
8438 triggered_spell_id = 66973;
8439 break; // Rank 3
8440 case 51425:
8441 triggered_spell_id = 66974;
8442 break; // Rank 4
8443
8444 // Frost Strike
8445 case 49143:
8446 triggered_spell_id = 66196;
8447 break; // Rank 1
8448 case 51416:
8449 triggered_spell_id = 66958;
8450 break; // Rank 2
8451 case 51417:
8452 triggered_spell_id = 66959;
8453 break; // Rank 3
8454 case 51418:
8455 triggered_spell_id = 66960;
8456 break; // Rank 4
8457 case 51419:
8458 triggered_spell_id = 66961;
8459 break; // Rank 5
8460 case 55268:
8461 triggered_spell_id = 66962;
8462 break; // Rank 6
8463
8464 // Plague Strike
8465 case 45462:
8466 triggered_spell_id = 66216;
8467 break; // Rank 1
8468 case 49917:
8469 triggered_spell_id = 66988;
8470 break; // Rank 2
8471 case 49918:
8472 triggered_spell_id = 66989;
8473 break; // Rank 3
8474 case 49919:
8475 triggered_spell_id = 66990;
8476 break; // Rank 4
8477 case 49920:
8478 triggered_spell_id = 66991;
8479 break; // Rank 5
8480 case 49921:
8481 triggered_spell_id = 66992;
8482 break; // Rank 6
8483
8484 // Death Strike
8485 case 49998:
8486 triggered_spell_id = 66188;
8487 break; // Rank 1
8488 case 49999:
8489 triggered_spell_id = 66950;
8490 break; // Rank 2
8491 case 45463:
8492 triggered_spell_id = 66951;
8493 break; // Rank 3
8494 case 49923:
8495 triggered_spell_id = 66952;
8496 break; // Rank 4
8497 case 49924:
8498 triggered_spell_id = 66953;
8499 break; // Rank 5
8500
8501 // Rune Strike
8502 case 56815:
8503 triggered_spell_id = 66217;
8504 break; // Rank 1
8505
8506 // Blood Strike
8507 case 45902:
8508 triggered_spell_id = 66215;
8509 break; // Rank 1
8510 case 49926:
8511 triggered_spell_id = 66975;
8512 break; // Rank 2
8513 case 49927:
8514 triggered_spell_id = 66976;
8515 break; // Rank 3
8516 case 49928:
8517 triggered_spell_id = 66977;
8518 break; // Rank 4
8519 case 49929:
8520 triggered_spell_id = 66978;
8521 break; // Rank 5
8522 case 49930:
8523 triggered_spell_id = 66979;
8524 break; // Rank 6
8525 default:
8526 return false;
8527 }
8528
8529 // This should do, restore spell mod so next attack can also use this!
8530 // crit chance for first strike is already computed
8531 ToPlayer()->RestoreSpellMods(m_currentSpells[CURRENT_GENERIC_SPELL], 51124, nullptr); // Killing Machine
8532 ToPlayer()->RestoreSpellMods(m_currentSpells[CURRENT_GENERIC_SPELL], 49796, nullptr); // Deathchill
8533
8534 // Xinef: Somehow basepoints are divided by 2 which is later divided by 2 (offhand multiplier)
8535 SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
8536 if (triggerEntry->SchoolMask & SPELL_SCHOOL_MASK_NORMAL)
8537 basepoints0 = triggerEntry->Effects[EFFECT_0].BasePoints * 2;
8538
8539 SetCantProc(true);
8540 if(basepoints0)
8541 CastCustomSpell(target, triggered_spell_id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura, originalCaster);
8542 else
8543 CastSpell(target, triggered_spell_id, true, castItem, triggeredByAura, originalCaster);
8544 SetCantProc(false);
8545 return true;
8546 }
8547 // Runic Power Back on Snare/Root
8548 if (dummySpell->Id == 61257)
8549 {
8550 // only for spells and hit/crit (trigger start always) and not start from self casted spells
8551 if (procSpell == 0 || !(procEx & (PROC_EX_NORMAL_HIT | PROC_EX_CRITICAL_HIT)) || this == victim)
8552 return false;
8553 // Need snare or root mechanic
8554 if (!(procSpell->GetAllEffectsMechanicMask() & ((1 << MECHANIC_ROOT) | (1 << MECHANIC_SNARE))))
8555 return false;
8556 triggered_spell_id = 61258;
8557 target = this;
8558 break;
8559 }
8560 // Sudden Doom
8561 if (dummySpell->SpellIconID == 1939 && GetTypeId() == TYPEID_PLAYER)
8562 {
8563 SpellChainNode const* chain = nullptr;
8564 // get highest rank of the Death Coil spell
8565 PlayerSpellMap const& sp_list = ToPlayer()->GetSpellMap();
8566 for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
8567 {
8568 // check if shown in spell book
8569 if (!itr->second->Active || !itr->second->IsInSpec(ToPlayer()->GetActiveSpec()) || itr->second->State == PLAYERSPELL_REMOVED)
8570 continue;
8571
8572 SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(itr->first);
8573 if (!spellProto)
8574 continue;
8575
8576 if (spellProto->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT
8577 && spellProto->SpellFamilyFlags[0] & 0x2000)
8578 {
8579 SpellChainNode const* newChain = sSpellMgr->GetSpellChainNode(itr->first);
8580
8581 // No chain entry or entry lower than found entry
8582 if (!chain || !newChain || (chain->rank < newChain->rank))
8583 {
8584 triggered_spell_id = itr->first;
8585 chain = newChain;
8586 }
8587 else
8588 continue;
8589 // Found spell is last in chain - do not need to look more
8590 // Optimisation for most common case
8591 if (chain && chain->last->Id == itr->first)
8592 break;
8593 }
8594 }
8595 }
8596 break;
8597 }
8598 case SPELLFAMILY_POTION:
8599 {
8600 // alchemist's stone
8601 if (dummySpell->Id == 17619)
8602 {
8603 if (procSpell->SpellFamilyName == SPELLFAMILY_POTION)
8604 {
8605 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; i++)
8606 {
8607 if (procSpell->Effects[i].Effect == SPELL_EFFECT_HEAL)
8608 {
8609 triggered_spell_id = 21399;
8610 }
8611 else if (procSpell->Effects[i].Effect == SPELL_EFFECT_ENERGIZE)
8612 {
8613 triggered_spell_id = 21400;
8614 }
8615 else
8616 continue;
8617
8618 basepoints0 = int32(CalculateSpellDamage(this, procSpell, i) * 0.4f);
8619 CastCustomSpell(this, triggered_spell_id, &basepoints0, nullptr, nullptr, true, nullptr, triggeredByAura);
8620 }
8621 return true;
8622 }
8623 }
8624 break;
8625 }
8626 case SPELLFAMILY_PET:
8627 {
8628 switch (dummySpell->SpellIconID)
8629 {
8630 // Guard Dog
8631 case 201:
8632 {
8633 if (!victim)
8634 return false;
8635
8636 triggered_spell_id = 54445;
8637 target = this;
8638 float addThreat = float(CalculatePct(procSpell->Effects[0].CalcValue(this), triggerAmount));
8639 victim->AddThreat(this, addThreat);
8640 break;
8641 }
8642 // Silverback
8643 case 1582:
8644 triggered_spell_id = dummySpell->Id == 62765 ? 62801 : 62800;
8645 target = this;
8646 break;
8647 }
8648 break;
8649 }
8650 default:
8651 break;
8652 }
8653
8654 // if not handled by custom case, get triggered spell from dummySpell proto
8655 if (!triggered_spell_id)
8656 triggered_spell_id = dummySpell->Effects[triggeredByAura->GetEffIndex()].TriggerSpell;
8657
8658 // processed charge only counting case
8659 if (!triggered_spell_id)
8660 return true;
8661
8662 SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
8663 if (!triggerEntry)
8664 {
8665 LOG_ERROR("entities.unit", "Unit::HandleDummyAuraProc: Spell {} has non-existing triggered spell {}", dummySpell->Id, triggered_spell_id);
8666 return false;
8667 }
8668
8669 if (cooldown_spell_id == 0)
8670 cooldown_spell_id = triggered_spell_id;
8671
8672 if (cooldown)
8673 {
8674 if (HasSpellCooldown(cooldown_spell_id))
8675 return false;
8676
8677 AddSpellCooldown(cooldown_spell_id, 0, cooldown);
8678 }
8679
8680 if(basepoints0)
8681 CastCustomSpell(target, triggered_spell_id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura, originalCaster);
8682 else
8683 CastSpell(target, triggered_spell_id, true, castItem, triggeredByAura, originalCaster);
8684
8685 return true;
8686}
constexpr auto IN_MILLISECONDS
Definition: Common.h:62
int32 irand(int32 min, int32 max)
Definition: Random.cpp:37
T ApplyPct(T &base, U pct)
Definition: Util.h:73
static First const & RAND(First const &first, Second const &second, Rest const &... rest)
Definition: CreatureAIImpl.h:30
EnchantmentSlot
Definition: Item.h:162
@ TEMP_ENCHANTMENT_SLOT
Definition: Item.h:164
std::map< uint32, SpellCooldown > SpellCooldowns
Definition: Player.h:209
std::unordered_map< uint32, PlayerSpell * > PlayerSpellMap
Definition: Player.h:194
@ EQUIPMENT_SLOT_MAINHAND
Definition: Player.h:691
@ PLAYERSPELL_REMOVED
Definition: Player.h:123
WeaponAttackType
Definition: Unit.h:395
@ SPELL_AURA_PROC_TRIGGER_SPELL
Definition: SpellAuraDefines.h:105
@ SPELL_AURA_HASTE_SPELLS
Definition: SpellAuraDefines.h:279
@ SPELL_AURA_MOD_MELEE_HASTE
Definition: SpellAuraDefines.h:201
@ SPELL_AURA_MOD_DECREASE_SPEED
Definition: SpellAuraDefines.h:96
@ SPELL_AURA_PERIODIC_DUMMY
Definition: SpellAuraDefines.h:289
@ PROC_EX_INTERNAL_HOT
Definition: SpellMgr.h:220
@ PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS
Definition: SpellMgr.h:128
@ PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS
Definition: SpellMgr.h:122
@ SPELL_EFFECT_ENERGIZE
Definition: SharedDefines.h:780
@ LANG_UNIVERSAL
Definition: SharedDefines.h:707
@ CLASS_DRUID
Definition: SharedDefines.h:123
@ CLASS_SHAMAN
Definition: SharedDefines.h:119
@ CLASS_PRIEST
Definition: SharedDefines.h:117
@ CLASS_WARLOCK
Definition: SharedDefines.h:121
@ CLASS_MAGE
Definition: SharedDefines.h:120
@ CLASS_PALADIN
Definition: SharedDefines.h:114
@ CLASS_ROGUE
Definition: SharedDefines.h:116
@ MECHANIC_STUN
Definition: SharedDefines.h:1309
@ MECHANIC_ROOT
Definition: SharedDefines.h:1304
@ MECHANIC_SNARE
Definition: SharedDefines.h:1308
@ SPELLFAMILY_WARLOCK
Definition: SharedDefines.h:3505
@ SPELLFAMILY_PALADIN
Definition: SharedDefines.h:3510
@ SPELLFAMILY_HUNTER
Definition: SharedDefines.h:3509
@ SPELLFAMILY_POTION
Definition: SharedDefines.h:3513
@ SPELLFAMILY_ROGUE
Definition: SharedDefines.h:3508
@ SPELLFAMILY_DRUID
Definition: SharedDefines.h:3507
@ SPELLFAMILY_PET
Definition: SharedDefines.h:3517
@ REP_EXALTED
Definition: SharedDefines.h:159
@ SPELL_SCHOOL_MASK_SHADOW
Definition: SharedDefines.h:274
@ SPELL_SCHOOL_MASK_FIRE
Definition: SharedDefines.h:271
@ SPELL_SCHOOL_MASK_FROST
Definition: SharedDefines.h:273
bool IsEqual(uint32 p1=0, uint32 p2=0, uint32 p3=0) const
Definition: Util.h:458
uint8 GetSlot() const
Definition: Item.h:272
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:295
bool IsEquipped() const
Definition: Item.cpp:791
void SetSpellModTakingSpell(Spell *spell, bool apply)
Definition: Player.cpp:9956
void RestoreSpellMods(Spell *spell, uint32 ownerAuraId=0, Aura *aura=nullptr)
Definition: Player.cpp:9814
bool HasSpellCooldown(uint32 spell_id) const override
Definition: Player.cpp:16210
PlayerSpellMap const & GetSpellMap() const
Definition: Player.h:1726
void AddSpellCooldown(uint32 spell_id, uint32 itemid, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
Definition: Player.cpp:10979
SpellCooldowns GetSpellCooldowns() const
Definition: Player.h:2119
static uint8 GetAttackBySlot(uint8 slot)
Definition: PlayerStorage.cpp:573
ReputationRank GetReputationRank(uint32 faction_id) const
Definition: Player.cpp:5763
Unit * GetSelectedUnit() const
Definition: Player.cpp:11429
void RemoveSpellCooldown(uint32 spell_id, bool update=false)
Definition: Player.cpp:3462
void Say(std::string_view text, Language language, WorldObject const *=nullptr) override
Handles said message in regular chat based on declared language and in config pre-defined Range.
Definition: Player.cpp:9211
Item * GetItemByGuid(ObjectGuid guid) const
Definition: PlayerStorage.cpp:438
Spell * m_spellModTakingSpell
Definition: Player.h:2499
uint32 GetCreatePowers(Powers power) const
Definition: Unit.cpp:15547
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5499
void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
Definition: Unit.cpp:5173
int32 CalculateSpellDamage(Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
Definition: Unit.cpp:14738
void SetCantProc(bool apply)
Definition: Unit.h:2321
bool HealthBelowPct(int32 pct) const
Definition: Unit.h:1444
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4835
int32 SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask, bool isDoT=false)
Definition: Unit.cpp:11898
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:10214
int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask)
Definition: Unit.cpp:11860
uint32 CountPctFromMaxHealth(int32 pct) const
Definition: Unit.h:1449
void CastDelayedSpellWithPeriodicAmount(Unit *caster, uint32 spellId, AuraType auraType, int32 addAmount, uint8 effectIndex=0)
Definition: Unit.cpp:20418
void RemoveMovementImpairingAuras(bool withRoot)
Definition: Unit.cpp:5149
void SetMaxDuration(int32 duration)
Definition: SpellAuras.h:130
SpellInfo const * GetSpellInfo() const
Definition: Spell.h:574
uint8 GetRank() const
Definition: SpellInfo.cpp:2477
int32 GetMaxDuration() const
Definition: SpellInfo.cpp:2328
uint32 ProcChance
Definition: SpellInfo.h:354
Definition: SpellMgr.h:547
SpellInfo const * last
Definition: SpellMgr.h:551
uint8 rank
Definition: SpellMgr.h:552

References AddPct(), Player::AddSpellCooldown(), AddSpellCooldown(), AddThreat(), ApplyPct(), AURA_REMOVE_BY_ENEMY_SPELL, BASE_ATTACK, SpellInfo::CalcPowerCost(), CalculatePct(), CalculateSpellDamage(), CastCustomSpell(), CastDelayedSpellWithPeriodicAmount(), CastSpell(), CLASS_DEATH_KNIGHT, CLASS_DRUID, CLASS_HUNTER, CLASS_MAGE, CLASS_PALADIN, CLASS_PRIEST, CLASS_ROGUE, CLASS_SHAMAN, CLASS_WARLOCK, CLASS_WARRIOR, CountPctFromMaxHealth(), CURRENT_GENERIC_SPELL, EFFECT_0, EFFECT_1, SpellInfo::Effects, ObjectGuid::Empty, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, SpellInfo::EquippedItemClass, SpellInfo::GetAllEffectsMechanicMask(), AuraEffect::GetAmount(), Player::GetAttackBySlot(), GetAttackTime(), GetAura(), GetAuraEffect(), GetAuraEffectsByType(), AuraEffect::GetBase(), AuraEffect::GetCaster(), Aura::GetCaster(), AuraEffect::GetCasterGUID(), Aura::GetCastItemGUID(), Aura::GetCharges(), getClass(), GetCreateMana(), GetCreatePowers(), WorldObject::GetDistance(), Aura::GetDuration(), Aura::GetEffect(), AuraEffect::GetEffIndex(), Item::GetEnchantmentId(), GameTime::GetGameTime(), Player::GetGroup(), GetGuardianPet(), Object::GetGUID(), GetHealth(), AuraEffect::GetId(), Player::GetItemByGuid(), Aura::GetMaxDuration(), SpellInfo::GetMaxDuration(), GetMaxHealth(), GetMaxPower(), GetOwner(), Spell::GetPowerCost(), getPowerType(), SpellInfo::GetRank(), Player::GetReputationRank(), SpellInfo::GetSchoolMask(), Player::GetSelectedUnit(), Item::GetSlot(), Player::GetSpellCooldowns(), AuraEffect::GetSpellInfo(), Player::GetSpellMap(), Aura::GetStackAmount(), Object::GetTypeId(), ObjectAccessor::GetUnit(), GetVictim(), HasAura(), Position::HasInArc(), Player::HasSpellCooldown(), HasSpellCooldown(), haveOffhandWeapon(), HealthBelowPct(), SpellInfo::Id, IN_MILLISECONDS, irand(), IsAlive(), flag96::IsEqual(), Item::IsEquipped(), IsFriendlyTo(), SpellInfo::IsPositive(), SpellInfo::IsRankOf(), LANG_UNIVERSAL, SpellChainNode::last, LOG_ERROR, m_currentSpells, Player::m_spellModTakingSpell, SpellInfo::ManaCost, MAX_SPELL_EFFECTS, MECHANIC_ROOT, MECHANIC_SNARE, MECHANIC_STUN, OFF_ATTACK, PLAYERSPELL_REMOVED, POWER_ENERGY, POWER_MANA, POWER_RAGE, POWER_RUNIC_POWER, PROC_EX_CRITICAL_HIT, PROC_EX_INTERNAL_HOT, PROC_EX_NORMAL_HIT, PROC_FLAG_DONE_MAINHAND_ATTACK, PROC_FLAG_DONE_OFFHAND_ATTACK, PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS, PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS, SpellInfo::ProcChance, RAND(), SpellChainNode::rank, RemoveAura(), RemoveAuraFromStack(), RemoveAurasByType(), RemoveAurasDueToSpell(), RemoveAurasWithMechanic(), RemoveMovementImpairingAuras(), Player::RemoveSpellCooldown(), REP_EXALTED, Player::RestoreSpellMods(), roll_chance_f(), roll_chance_i(), Player::Say(), SpellInfo::SchoolMask, AuraEffect::SetAmount(), SetCantProc(), Aura::SetDuration(), Aura::SetMaxDuration(), Player::SetSpellModTakingSpell(), SPELL_AURA_DUMMY, SPELL_AURA_HASTE_SPELLS, SPELL_AURA_MOD_DECREASE_SPEED, SPELL_AURA_MOD_MELEE_HASTE, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE_PERCENT, SPELL_AURA_PERIODIC_DUMMY, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_LEECH, SPELL_AURA_PROC_TRIGGER_SPELL, SPELL_EFFECT_ENERGIZE, SPELL_EFFECT_HEAL, SPELL_SCHOOL_MASK_FIRE, SPELL_SCHOOL_MASK_FROST, SPELL_SCHOOL_MASK_NORMAL, SPELL_SCHOOL_MASK_SHADOW, SpellBaseDamageBonusDone(), SpellBaseDamageBonusTaken(), SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_DRUID, SPELLFAMILY_GENERIC, SPELLFAMILY_HUNTER, SPELLFAMILY_MAGE, SPELLFAMILY_PALADIN, SPELLFAMILY_PET, SPELLFAMILY_POTION, SPELLFAMILY_PRIEST, SPELLFAMILY_ROGUE, SPELLFAMILY_SHAMAN, SPELLFAMILY_WARLOCK, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, SPELLVALUE_BASE_POINT0, SpellInfo::SpellVisual, sSpellMgr, TEMP_ENCHANTMENT_SLOT, Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, and urand().

Referenced by ProcDamageAndSpellFor().

◆ HandleEmoteCommand()

void Unit::HandleEmoteCommand ( uint32  emoteId)
1971{
1973 packet.EmoteID = emoteId;
1974 packet.Guid = GetGUID();
1975 SendMessageToSet(packet.Write(), true);
1976}
Definition: ChatPackets.h:29
WorldPacket const * Write() override
Definition: ChatPackets.cpp:20
uint32 EmoteID
Definition: ChatPackets.h:35
ObjectGuid Guid
Definition: ChatPackets.h:36

References WorldPackets::Chat::Emote::EmoteID, Object::GetGUID(), WorldPackets::Chat::Emote::Guid, WorldObject::SendMessageToSet(), and WorldPackets::Chat::Emote::Write().

Referenced by npc_mograine::npc_mograineAI::AshbringerEvent(), boss_kiljaeden::boss_kiljaedenAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), boss_viscidus::DamageTaken(), DealMeleeDamage(), boss_twinemperorsAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), StandUpEvent::Execute(), PartyTimeEmoteEvent::Execute(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), boss_ragnaros::boss_ragnarosAI::HandleEmerge(), WorldSession::HandleEmoteOpcode(), npc_commandscript::HandleNpcSayCommand(), npc_commandscript::HandleNpcYellCommand(), WorldSession::HandleTextEmoteOpcode(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), npc_sentinel_leader::MovementInform(), npc_sentinel_infiltrator::MovementInform(), npc_fos_leader_second::npc_fos_leader_secondAI::MovementInform(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::MovementInform(), boss_felmyst::boss_felmystAI::MovementInform(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::MovementInform(), npc_fairbanks::OnGossipSelect(), boss_nefarian::PathEndReached(), spell_gen_spectator_cheer_trigger::PrepareSpellScript(), npc_dancing_flames::npc_dancing_flamesAI::ReceiveEmote(), PetAI::ReceiveEmote(), npc_plucky::npc_pluckyAI::ReceiveEmote(), boss_ragnaros::boss_ragnarosAI::Reset(), CreatureTextMgr::SendEmote(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), boss_gothik::boss_gothikAI::SpellHit(), npc_wounded_skirmisher::SpellHit(), boss_nightbane::boss_nightbaneAI::TakeOff(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_nightbane::boss_nightbaneAI::UpdateAI(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), npc_partygoer_pather::UpdateAI(), npc_partygoer::UpdateAI(), npc_sentinel_leader::UpdateAI(), npc_sentinel_infiltrator::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_forest_frog::npc_forest_frogAI::UpdateAI(), npc_winterfin_playmate::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_shenthul::npc_shenthulAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_highlord_tirion_fordring_lh::npc_highlord_tirion_fordringAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_valiance_keep_cannoneer::npc_valiance_keep_cannoneerAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_dancing_flames::npc_dancing_flamesAI::UpdateAI(), npc_maxx_a_million_escort::npc_maxx_a_million_escortAI::UpdateAI(), npc_rocknot::npc_rocknotAI::WaypointReached(), npc_daphne_stilwell::npc_daphne_stilwellAI::WaypointReached(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), npc_taretha::npc_tarethaAI::WaypointReached(), npc_general_andorov::WaypointReached(), npc_mootoo_the_younger::npc_mootoo_the_youngerAI::WaypointReached(), npc_engineer_helice::npc_engineer_heliceAI::WaypointReached(), npc_maxx_a_million_escort::npc_maxx_a_million_escortAI::WaypointReached(), and npc_isla_starmane::npc_isla_starmaneAI::WaypointReached().

◆ HandleOverrideClassScriptAuraProc()

bool Unit::HandleOverrideClassScriptAuraProc ( Unit victim,
uint32  damage,
AuraEffect triggeredByAura,
SpellInfo const *  procSpell,
uint32  cooldown 
)
private
9835{
9836 int32 scriptId = triggeredByAura->GetMiscValue();
9837
9838 if (!victim || !victim->IsAlive())
9839 return false;
9840
9841 Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER
9842 ? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : nullptr;
9843
9844 uint32 triggered_spell_id = 0;
9845
9846 switch (scriptId)
9847 {
9848 case 836: // Improved Blizzard (Rank 1)
9849 {
9850 if (!procSpell || procSpell->SpellVisual[0] != 9487)
9851 return false;
9852 triggered_spell_id = 12484;
9853 break;
9854 }
9855 case 988: // Improved Blizzard (Rank 2)
9856 {
9857 if (!procSpell || procSpell->SpellVisual[0] != 9487)
9858 return false;
9859 triggered_spell_id = 12485;
9860 break;
9861 }
9862 case 989: // Improved Blizzard (Rank 3)
9863 {
9864 if (!procSpell || procSpell->SpellVisual[0] != 9487)
9865 return false;
9866 triggered_spell_id = 12486;
9867 break;
9868 }
9869 case 4533: // Dreamwalker Raiment 2 pieces bonus
9870 {
9871 // Chance 50%
9872 if (!roll_chance_i(50))
9873 return false;
9874
9875 switch (victim->getPowerType())
9876 {
9877 case POWER_MANA:
9878 triggered_spell_id = 28722;
9879 break;
9880 case POWER_RAGE:
9881 triggered_spell_id = 28723;
9882 break;
9883 case POWER_ENERGY:
9884 triggered_spell_id = 28724;
9885 break;
9886 default:
9887 return false;
9888 }
9889 break;
9890 }
9891 case 4537: // Dreamwalker Raiment 6 pieces bonus
9892 triggered_spell_id = 28750; // Blessing of the Claw
9893 break;
9894 case 5497: // Improved Mana Gems
9895 triggered_spell_id = 37445; // Mana Surge
9896 break;
9897 case 7010: // Revitalize - can proc on full hp target
9898 case 7011:
9899 case 7012:
9900 {
9901 if (!roll_chance_i(triggeredByAura->GetAmount()))
9902 return false;
9903 switch (victim->getPowerType())
9904 {
9905 case POWER_MANA:
9906 triggered_spell_id = 48542;
9907 break;
9908 case POWER_RAGE:
9909 triggered_spell_id = 48541;
9910 break;
9911 case POWER_ENERGY:
9912 triggered_spell_id = 48540;
9913 break;
9914 case POWER_RUNIC_POWER:
9915 triggered_spell_id = 48543;
9916 break;
9917 default:
9918 break;
9919 }
9920 break;
9921 }
9922 default:
9923 break;
9924 }
9925
9926 // not processed
9927 if (!triggered_spell_id)
9928 return false;
9929
9930 // standard non-dummy case
9931 SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
9932
9933 if (!triggerEntry)
9934 {
9935 LOG_ERROR("entities.unit", "Unit::HandleOverrideClassScriptAuraProc: Spell {} triggering for class script id {}", triggered_spell_id, scriptId);
9936 return false;
9937 }
9938
9939 if (cooldown)
9940 {
9941 if (HasSpellCooldown(triggered_spell_id))
9942 return false;
9943
9944 AddSpellCooldown(triggered_spell_id, 0, cooldown);
9945 }
9946
9947 CastSpell(victim, triggered_spell_id, true, castItem, triggeredByAura);
9948
9949 return true;
9950}

References AddSpellCooldown(), CastSpell(), AuraEffect::GetAmount(), AuraEffect::GetBase(), Aura::GetCastItemGUID(), Player::GetItemByGuid(), AuraEffect::GetMiscValue(), getPowerType(), Object::GetTypeId(), HasSpellCooldown(), IsAlive(), LOG_ERROR, POWER_ENERGY, POWER_MANA, POWER_RAGE, POWER_RUNIC_POWER, roll_chance_i(), SpellInfo::SpellVisual, sSpellMgr, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by ProcDamageAndSpellFor().

◆ HandleProcExtraAttackFor()

void Unit::HandleProcExtraAttackFor ( Unit victim,
uint32  count 
)
2719{
2720 while (count)
2721 {
2722 --count;
2723 AttackerStateUpdate(victim, BASE_ATTACK, true);
2724 }
2725}
void AttackerStateUpdate(Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false, bool ignoreCasting=false)
Definition: Unit.cpp:2527

References AttackerStateUpdate(), and BASE_ATTACK.

Referenced by Update().

◆ HandleProcTriggerSpell()

bool Unit::HandleProcTriggerSpell ( Unit victim,
uint32  damage,
AuraEffect triggeredByAura,
SpellInfo const *  procSpell,
uint32  procFlag,
uint32  procEx,
uint32  cooldown,
uint32  procPhase,
ProcEventInfo eventInfo 
)
private
8886{
8887 // Get triggered aura spell info
8888 SpellInfo const* auraSpellInfo = triggeredByAura->GetSpellInfo();
8889
8890 // Basepoints of trigger aura
8891 int32 triggerAmount = triggeredByAura->GetAmount();
8892
8893 // Set trigger spell id, target, custom basepoints
8894 uint32 trigger_spell_id = auraSpellInfo->Effects[triggeredByAura->GetEffIndex()].TriggerSpell;
8895
8896 Unit* target = nullptr;
8897 int32 basepoints0 = 0;
8898
8899 if (triggeredByAura->GetAuraType() == SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE)
8900 basepoints0 = triggerAmount;
8901
8902 Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER
8903 ? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : nullptr;
8904
8905 // Try handle unknown trigger spells
8906 //if (sSpellMgr->GetSpellInfo(trigger_spell_id) == nullptr)
8907 {
8908 switch (auraSpellInfo->SpellFamilyName)
8909 {
8911 switch (auraSpellInfo->Id)
8912 {
8913 case 43820: // Charm of the Witch Doctor (Amani Charm of the Witch Doctor trinket)
8914 // Pct value stored in dummy
8915 if (!victim)
8916 return false;
8917 basepoints0 = victim->GetCreateHealth() * auraSpellInfo->Effects[1].CalcValue() / 100;
8918 target = victim;
8919 break;
8920 case 57345: // Darkmoon Card: Greatness
8921 {
8922 float stat = 0.0f;
8923 // strength
8924 if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 60229; stat = GetStat(STAT_STRENGTH); }
8925 // agility
8926 if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 60233; stat = GetStat(STAT_AGILITY); }
8927 // intellect
8928 if (GetStat(STAT_INTELLECT) > stat) { trigger_spell_id = 60234; stat = GetStat(STAT_INTELLECT);}
8929 // spirit
8930 if (GetStat(STAT_SPIRIT) > stat) { trigger_spell_id = 60235; }
8931 break;
8932 }
8933 case 67702: // Death's Choice, Item - Coliseum 25 Normal Melee Trinket
8934 {
8935 if (!damage)
8936 return false;
8937 float stat = 0.0f;
8938 // strength
8939 if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 67708; stat = GetStat(STAT_STRENGTH); }
8940 // agility
8941 if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 67703; }
8942 break;
8943 }
8944 case 67771: // Death's Choice (heroic), Item - Coliseum 25 Heroic Melee Trinket
8945 {
8946 if (!damage)
8947 return false;
8948 float stat = 0.0f;
8949 // strength
8950 if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 67773; stat = GetStat(STAT_STRENGTH); }
8951 // agility
8952 if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 67772; }
8953 break;
8954 }
8955 // Mana Drain Trigger
8956 case 27522:
8957 case 40336:
8958 {
8959 // On successful melee or ranged attack gain $29471s1 mana and if possible drain $27526s1 mana from the target.
8960 if (IsAlive())
8961 CastSpell(this, 29471, true, castItem, triggeredByAura);
8962 if (victim && victim->IsAlive())
8963 CastSpell(victim, 27526, true, castItem, triggeredByAura);
8964 return true;
8965 }
8966 // Forge of Souls, Devourer of Souls, Mirrored Soul
8967 case 69023:
8968 {
8969 int32 dmg = damage * 0.45f;
8970 if (dmg > 0)
8971 if (Aura* a = GetAura(69023))
8972 if (Unit* c = a->GetCaster())
8973 CastCustomSpell(c, 69034, &dmg, 0, 0, true);
8974 return true;
8975 }
8976 // Soul-Trader Beacon proc aura
8977 case 50051:
8978 {
8979 if (!victim)
8980 return false;
8981
8983 cr->CastSpell(victim, 50101, true);
8984
8985 return false;
8986 }
8987 }
8988 break;
8989 case SPELLFAMILY_MAGE:
8990 if (auraSpellInfo->SpellIconID == 2127) // Blazing Speed
8991 {
8992 switch (auraSpellInfo->Id)
8993 {
8994 case 31641: // Rank 1
8995 case 31642: // Rank 2
8996 trigger_spell_id = 31643;
8997 break;
8998 default:
8999 LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell {} miss posibly Blazing Speed", auraSpellInfo->Id);
9000 return false;
9001 }
9002 }
9003 else if (auraSpellInfo->Id == 71761) // Deep Freeze Immunity State (only permanent)
9004 {
9005 Creature* creature = victim->ToCreature();
9006 if (!creature || !creature->HasMechanicTemplateImmunity(1 << (MECHANIC_STUN - 1)))
9007 return false;
9008 }
9009 break;
9011 {
9012 // Nether Protection
9013 if (auraSpellInfo->SpellIconID == 1985)
9014 {
9015 if (!procSpell)
9016 return false;
9017 switch (GetFirstSchoolInMask(procSpell->GetSchoolMask()))
9018 {
9020 return false; // ignore
9021 case SPELL_SCHOOL_HOLY:
9022 trigger_spell_id = 54370;
9023 break;
9024 case SPELL_SCHOOL_FIRE:
9025 trigger_spell_id = 54371;
9026 break;
9028 trigger_spell_id = 54375;
9029 break;
9030 case SPELL_SCHOOL_FROST:
9031 trigger_spell_id = 54372;
9032 break;
9034 trigger_spell_id = 54374;
9035 break;
9037 trigger_spell_id = 54373;
9038 break;
9039 default:
9040 return false;
9041 }
9042 }
9043 break;
9044 }
9045 case SPELLFAMILY_PRIEST:
9046 {
9047 // Blessed Recovery
9048 if (auraSpellInfo->SpellIconID == 1875)
9049 {
9050 switch (auraSpellInfo->Id)
9051 {
9052 case 27811:
9053 trigger_spell_id = 27813;
9054 break;
9055 case 27815:
9056 trigger_spell_id = 27817;
9057 break;
9058 case 27816:
9059 trigger_spell_id = 27818;
9060 break;
9061 default:
9062 LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell {} not handled in BR", auraSpellInfo->Id);
9063 return false;
9064 }
9065 basepoints0 = CalculatePct(int32(damage), triggerAmount) / 3;
9066 target = this;
9067 // Add remaining ticks to healing done
9068 CastDelayedSpellWithPeriodicAmount(this, trigger_spell_id, SPELL_AURA_PERIODIC_HEAL, basepoints0);
9069 return true;
9070 }
9071 break;
9072 }
9073 case SPELLFAMILY_DRUID:
9074 {
9075 switch (auraSpellInfo->Id)
9076 {
9077 // Druid Forms Trinket
9078 case 37336:
9079 {
9080 switch (GetShapeshiftForm())
9081 {
9082 case FORM_NONE:
9083 trigger_spell_id = 37344;
9084 break;
9085 case FORM_CAT:
9086 trigger_spell_id = 37341;
9087 break;
9088 case FORM_BEAR:
9089 case FORM_DIREBEAR:
9090 trigger_spell_id = 37340;
9091 break;
9092 case FORM_TREE:
9093 trigger_spell_id = 37342;
9094 break;
9095 case FORM_MOONKIN:
9096 trigger_spell_id = 37343;
9097 break;
9098 default:
9099 return false;
9100 }
9101 break;
9102 }
9103 // Druid T9 Feral Relic (Lacerate, Swipe, Mangle, and Shred)
9104 case 67353:
9105 {
9106 switch (GetShapeshiftForm())
9107 {
9108 case FORM_CAT:
9109 trigger_spell_id = 67355;
9110 break;
9111 case FORM_BEAR:
9112 case FORM_DIREBEAR:
9113 trigger_spell_id = 67354;
9114 break;
9115 default:
9116 return false;
9117 }
9118 break;
9119 }
9120 default:
9121 break;
9122 }
9123 break;
9124 }
9125 case SPELLFAMILY_HUNTER:
9126 {
9127 if (auraSpellInfo->SpellIconID == 3247) // Piercing Shots
9128 {
9129 if (!victim)
9130 return false;
9131
9132 switch (auraSpellInfo->Id)
9133 {
9134 case 53234: // Rank 1
9135 case 53237: // Rank 2
9136 case 53238: // Rank 3
9137 trigger_spell_id = 63468;
9138 break;
9139 default:
9140 LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell {} miss posibly Piercing Shots", auraSpellInfo->Id);
9141 return false;
9142 }
9143 SpellInfo const* TriggerPS = sSpellMgr->GetSpellInfo(trigger_spell_id);
9144 if (!TriggerPS)
9145 return false;
9146
9147 basepoints0 = CalculatePct(int32(damage), triggerAmount) / (TriggerPS->GetMaxDuration() / TriggerPS->Effects[0].Amplitude);
9148 victim->CastDelayedSpellWithPeriodicAmount(this, trigger_spell_id, SPELL_AURA_PERIODIC_DAMAGE, basepoints0);
9149 return true;
9150 }
9151 // Item - Hunter T9 4P Bonus (Steady Shot)
9152 else if (auraSpellInfo->Id == 67151)
9153 {
9154 if (GetTypeId() != TYPEID_PLAYER || !ToPlayer()->GetPet())
9155 return false;
9156
9157 target = ToPlayer()->GetPet();
9158 trigger_spell_id = 68130;
9159 break;
9160 }
9161 break;
9162 }
9164 {
9165 switch (auraSpellInfo->Id)
9166 {
9167 // Soul Preserver
9168 case 60510:
9169 {
9170 switch (getClass())
9171 {
9172 case CLASS_DRUID:
9173 trigger_spell_id = 60512;
9174 break;
9175 case CLASS_PALADIN:
9176 trigger_spell_id = 60513;
9177 break;
9178 case CLASS_PRIEST:
9179 trigger_spell_id = 60514;
9180 break;
9181 case CLASS_SHAMAN:
9182 trigger_spell_id = 60515;
9183 break;
9184 }
9185
9186 target = this;
9187 break;
9188 }
9189 case 37657: // Lightning Capacitor
9190 case 54841: // Thunder Capacitor
9191 case 67712: // Item - Coliseum 25 Normal Caster Trinket
9192 case 67758: // Item - Coliseum 25 Heroic Caster Trinket
9193 {
9194 if (!victim || !victim->IsAlive() || GetTypeId() != TYPEID_PLAYER)
9195 return false;
9196
9197 uint32 stack_spell_id = 0;
9198 switch (auraSpellInfo->Id)
9199 {
9200 case 37657:
9201 stack_spell_id = 37658;
9202 trigger_spell_id = 37661;
9203 break;
9204 case 54841:
9205 stack_spell_id = 54842;
9206 trigger_spell_id = 54843;
9207 break;
9208 case 67712:
9209 stack_spell_id = 67713;
9210 trigger_spell_id = 67714;
9211 break;
9212 case 67758:
9213 stack_spell_id = 67759;
9214 trigger_spell_id = 67760;
9215 break;
9216 }
9217
9218 if (cooldown && GetTypeId() == TYPEID_PLAYER)
9219 {
9220 if (ToPlayer()->HasSpellCooldown(stack_spell_id))
9221 return false;
9222
9223 ToPlayer()->AddSpellCooldown(stack_spell_id, 0, cooldown);
9224 }
9225
9226 CastSpell(this, stack_spell_id, true, nullptr, triggeredByAura);
9227
9228 Aura* dummy = GetAura(stack_spell_id);
9229 if (!dummy || dummy->GetStackAmount() < triggerAmount)
9230 return false;
9231
9232 RemoveAurasDueToSpell(stack_spell_id);
9233 CastSpell(victim, trigger_spell_id, true, nullptr, triggeredByAura);
9234 return true;
9235 }
9236 default:
9237 // Illumination
9238 if (auraSpellInfo->SpellIconID == 241)
9239 {
9240 if (!procSpell)
9241 return false;
9242 // procspell is triggered spell but we need mana cost of original casted spell
9243 uint32 originalSpellId = procSpell->Id;
9244 // Holy Shock heal
9245 if (procSpell->SpellFamilyFlags[1] & 0x00010000)
9246 {
9247 switch (procSpell->Id)
9248 {
9249 case 25914:
9250 originalSpellId = 20473;
9251 break;
9252 case 25913:
9253 originalSpellId = 20929;
9254 break;
9255 case 25903:
9256 originalSpellId = 20930;
9257 break;
9258 case 27175:
9259 originalSpellId = 27174;
9260 break;
9261 case 33074:
9262 originalSpellId = 33072;
9263 break;
9264 case 48820:
9265 originalSpellId = 48824;
9266 break;
9267 case 48821:
9268 originalSpellId = 48825;
9269 break;
9270 default:
9271 LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell {} not handled in HShock", procSpell->Id);
9272 return false;
9273 }
9274 }
9275 SpellInfo const* originalSpell = sSpellMgr->GetSpellInfo(originalSpellId);
9276 if (!originalSpell)
9277 {
9278 LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell {} unknown but selected as original in Illu", originalSpellId);
9279 return false;
9280 }
9281 // percent stored in effect 1 (class scripts) base points
9282 int32 cost = int32(originalSpell->ManaCost + CalculatePct(GetCreateMana(), originalSpell->ManaCostPercentage));
9283 basepoints0 = CalculatePct(cost, auraSpellInfo->Effects[1].CalcValue());
9284 trigger_spell_id = 20272;
9285 target = this;
9286 }
9287 break;
9288 }
9289 break;
9290 }
9291 case SPELLFAMILY_SHAMAN:
9292 {
9293 // Lightning Shield (overwrite non existing triggered spell call in spell.dbc
9294 if (auraSpellInfo->SpellFamilyFlags[0] & 0x400 && auraSpellInfo->HasAttribute(SPELL_ATTR1_NO_THREAT))
9295 {
9296 // Do not proc off from self-casted items
9297 if (Spell const* spell = eventInfo.GetProcSpell())
9298 {
9299 if (spell->m_castItemGUID && victim->GetGUID() == GetGUID())
9300 {
9301 return false;
9302 }
9303 }
9304
9305 trigger_spell_id = sSpellMgr->GetSpellWithRank(26364, auraSpellInfo->GetRank());
9306 }
9307 // Nature's Guardian
9308 else if (auraSpellInfo->SpellIconID == 2013)
9309 {
9310 // Check health condition - should drop to less 30% (damage deal after this!)
9311 if (!HealthBelowPctDamaged(30, damage))
9312 return false;
9313
9314 if (victim && victim->IsAlive())
9315 victim->GetThreatMgr().ModifyThreatByPercent(this, -10);
9316
9317 basepoints0 = int32(CountPctFromMaxHealth(triggerAmount));
9318 trigger_spell_id = 31616;
9319 target = this;
9320 }
9321 break;
9322 }
9324 {
9325 // Acclimation
9326 if (auraSpellInfo->SpellIconID == 1930)
9327 {
9328 if (!procSpell)
9329 return false;
9330 switch (GetFirstSchoolInMask(procSpell->GetSchoolMask()))
9331 {
9333 return false; // ignore
9334 case SPELL_SCHOOL_HOLY:
9335 trigger_spell_id = 50490;
9336 break;
9337 case SPELL_SCHOOL_FIRE:
9338 trigger_spell_id = 50362;
9339 break;
9341 trigger_spell_id = 50488;
9342 break;
9343 case SPELL_SCHOOL_FROST:
9344 trigger_spell_id = 50485;
9345 break;
9347 trigger_spell_id = 50489;
9348 break;
9350 trigger_spell_id = 50486;
9351 break;
9352 default:
9353 return false;
9354 }
9355 }
9356 // Blood Presence (Improved)
9357 else if (auraSpellInfo->Id == 63611)
9358 {
9359 if (GetTypeId() != TYPEID_PLAYER)
9360 return false;
9361
9362 trigger_spell_id = 50475;
9363 basepoints0 = CalculatePct(int32(damage), triggerAmount);
9364 }
9365 break;
9366 }
9367 }
9368 }
9369
9370 // All ok. Check current trigger spell
9371 SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(trigger_spell_id);
9372 if (!triggerEntry)
9373 {
9374 // Don't cast unknown spell
9375 LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell {} (effIndex: {}) has unknown TriggerSpell {}. Unhandled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex(), trigger_spell_id);
9376 return false;
9377 }
9378
9379 // not allow proc extra attack spell at extra attack
9380 if (triggerEntry->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
9381 {
9382 uint32 lastExtraAttackSpell = eventInfo.GetActor()->GetLastExtraAttackSpell();
9383
9384 // Patch 1.12.0(?) extra attack abilities can no longer chain proc themselves
9385 if (lastExtraAttackSpell == trigger_spell_id)
9386 {
9387 return false;
9388 }
9389
9390 // Patch 2.2.0 Sword Specialization (Warrior, Rogue) extra attack can no longer proc additional extra attacks
9391 // 3.3.5 Sword Specialization (Warrior), Hack and Slash (Rogue)
9392 if (lastExtraAttackSpell == SPELL_SWORD_SPECIALIZATION || lastExtraAttackSpell == SPELL_HACK_AND_SLASH)
9393 {
9394 return false;
9395 }
9396 }
9397
9398 // Custom requirements (not listed in procEx) Warning! damage dealing after this
9399 // Custom triggered spells
9400 switch (auraSpellInfo->Id)
9401 {
9402 // Deep Wounds
9403 case 12834:
9404 case 12849:
9405 case 12867:
9406 {
9407 if (GetTypeId() != TYPEID_PLAYER)
9408 return false;
9409
9410 if (procFlags & PROC_FLAG_DONE_OFFHAND_ATTACK)
9412 else
9414 break;
9415 }
9416 // Persistent Shield (Scarab Brooch trinket)
9417 // This spell originally trigger 13567 - Dummy Trigger (vs dummy efect)
9418 case 26467:
9419 {
9420 basepoints0 = int32(CalculatePct(damage, 15));
9421 target = victim;
9422 trigger_spell_id = 26470;
9423 break;
9424 }
9425 // Unyielding Knights (item exploit 29108\29109)
9426 case 38164:
9427 {
9428 if (!victim || victim->GetEntry() != 19457) // Proc only if your target is Grillok
9429 return false;
9430 break;
9431 }
9432 // Deflection
9433 case 52420:
9434 {
9435 if (!HealthBelowPct(35))
9436 return false;
9437 break;
9438 }
9439
9440 // Cheat Death
9441 case 28845:
9442 {
9443 // When your health drops below 20%
9444 if (HealthBelowPctDamaged(20, damage) || HealthBelowPct(20))
9445 return false;
9446 break;
9447 }
9448 // Deadly Swiftness (Rank 1)
9449 case 31255:
9450 {
9451 // whenever you deal damage to a target who is below 20% health.
9452 if (!victim || !victim->IsAlive() || victim->HealthAbovePct(20))
9453 return false;
9454
9455 target = this;
9456 trigger_spell_id = 22588;
9457 [[fallthrough]]; // TODO: Not sure whether the fallthrough was a mistake (forgetting a break) or intended. This should be double-checked.
9458 }
9459 // Bonus Healing (Crystal Spire of Karabor mace)
9460 case 40971:
9461 {
9462 // If your target is below $s1% health
9463 if (!victim || !victim->IsAlive() || victim->HealthAbovePct(triggerAmount))
9464 return false;
9465 break;
9466 }
9467 // Rapid Recuperation
9468 case 53228:
9469 case 53232:
9470 {
9471 // This effect only from Rapid Fire (ability cast)
9472 if (!procSpell || !(procSpell->SpellFamilyFlags[0] & 0x20))
9473 return false;
9474 break;
9475 }
9476 // Decimation
9477 case 63156:
9478 case 63158:
9479 // Can proc only if target has hp below 35%
9480 if (!victim || !victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, procSpell, this))
9481 return false;
9482 break;
9483 // Ulduar, Hodir, Toasty Fire
9484 case 62821:
9485 if (this->GetTypeId() != TYPEID_PLAYER) // spell has Attribute, but persistent area auras ignore it
9486 return false;
9487 break;
9488 case 15337: // Improved Spirit Tap (Rank 1)
9489 case 15338: // Improved Spirit Tap (Rank 2)
9490 {
9491 if (!procSpell)
9492 return false;
9493
9494 if (procSpell->SpellFamilyFlags[0] & 0x800000)
9495 if ((procSpell->Id != 58381) || !roll_chance_i(50))
9496 return false;
9497
9498 target = victim;
9499 break;
9500 }
9501 // Professor Putricide - Ooze Spell Tank Protection
9502 case 71770:
9503 if (victim)
9504 victim->CastSpell(victim, trigger_spell_id, true); // EffectImplicitTarget is self
9505 return true;
9506 case 45057: // Evasive Maneuvers (Commendation of Kael`thas trinket)
9507 case 71634: // Item - Icecrown 25 Normal Tank Trinket 1
9508 case 71640: // Item - Icecrown 25 Heroic Tank Trinket 1
9509 case 75475: // Item - Chamber of Aspects 25 Normal Tank Trinket
9510 case 75481: // Item - Chamber of Aspects 25 Heroic Tank Trinket
9511 {
9512 // Procs only if damage takes health below $s1%
9513 if (!HealthBelowPctDamaged(triggerAmount, damage))
9514 return false;
9515 break;
9516 }
9517 default:
9518 break;
9519 }
9520
9521 if (auraSpellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT)
9522 {
9523 // Xinef: keep this order, Aura 70656 has SpellIconID 85!
9524 // Item - Death Knight T10 Melee 4P Bonus
9525 if (auraSpellInfo->Id == 70656)
9526 {
9528 return false;
9529
9530 for (uint8 i = 0; i < MAX_RUNES; ++i)
9531 if (ToPlayer()->GetRuneCooldown(i) == 0)
9532 return false;
9533 }
9534 // Blade Barrier
9535 else if (auraSpellInfo->SpellIconID == 85)
9536 {
9537 Player* plr = ToPlayer();
9538 if (!plr || plr->getClass() != CLASS_DEATH_KNIGHT || !procSpell)
9539 return false;
9540
9542 return false;
9543 }
9544 // Rime
9545 else if (auraSpellInfo->SpellIconID == 56)
9546 {
9547 if (GetTypeId() != TYPEID_PLAYER)
9548 return false;
9549
9550 // Howling Blast
9552 }
9553 }
9554
9555 // Custom basepoints/target for exist spell
9556 // dummy basepoints or other customs
9557 switch (trigger_spell_id)
9558 {
9559 // Auras which should proc on area aura source (caster in this case):
9560 // Turn the Tables
9561 case 52914:
9562 case 52915:
9563 case 52910:
9564 // Honor Among Thieves
9565 case 51699:
9566 {
9567 target = triggeredByAura->GetBase()->GetCaster();
9568 if (!target)
9569 return false;
9570
9571 if (Player* pTarget = target->ToPlayer())
9572 {
9573 if (cooldown)
9574 {
9575 if (pTarget->HasSpellCooldown(trigger_spell_id) )
9576 return false;
9577 pTarget->AddSpellCooldown(trigger_spell_id, 0, cooldown);
9578 }
9579
9580 Unit* cptarget = nullptr;
9581 if (trigger_spell_id == 51699)
9582 {
9583 cptarget = pTarget->GetComboTarget();
9584 if (!cptarget)
9585 {
9586 cptarget = pTarget->GetSelectedUnit();
9587 }
9588 }
9589 else
9590 cptarget = target;
9591
9592 if (cptarget)
9593 {
9594 target->CastSpell(cptarget, trigger_spell_id, true);
9595 return true;
9596 }
9597 }
9598 return false;
9599 }
9600 // Cast positive spell on enemy target
9601 case 7099: // Curse of Mending
9602 case 39703: // Curse of Mending
9603 case 29494: // Temptation
9604 case 20233: // Improved Lay on Hands (cast on target)
9605 {
9606 target = victim;
9607 break;
9608 }
9609 // Ruby Drake, Evasive Aura
9610 case 50241:
9611 {
9612 if( GetAura(50240) )
9613 return false;
9614
9615 break;
9616 }
9617 // Combo points add triggers (need add combopoint only for main target, and after possible combopoints reset)
9618 case 15250: // Rogue Setup
9619 {
9620 // applied only for main target
9621 if (!victim || (GetTypeId() == TYPEID_PLAYER && victim != ToPlayer()->GetSelectedUnit()))
9622 return false;
9623 break; // continue normal case
9624 }
9625 // Finish movies that add combo
9626 case 14189: // Seal Fate (Netherblade set)
9627 case 14157: // Ruthlessness
9628 {
9629 victim = nullptr;
9630 // Need add combopoint AFTER finish movie (or they dropped in finish phase)
9631 break;
9632 }
9633 // Item - Druid T10 Balance 2P Bonus
9634 case 16870:
9635 {
9636 if (HasAura(70718))
9637 CastSpell(this, 70721, true);
9638 RemoveAurasDueToSpell(trigger_spell_id);
9639 break;
9640 }
9641 // Shamanistic Rage triggered spell
9642 case 30824:
9643 {
9644 basepoints0 = int32(CalculatePct(GetTotalAttackPowerValue(BASE_ATTACK), triggerAmount));
9645 break;
9646 }
9647 // Enlightenment (trigger only from mana cost spells)
9648 case 35095:
9649 {
9650 if (!procSpell || procSpell->PowerType != POWER_MANA || (procSpell->ManaCost == 0 && procSpell->ManaCostPercentage == 0 && procSpell->ManaCostPerlevel == 0))
9651 return false;
9652 break;
9653 }
9654 // Demonic Pact
9655 case 48090:
9656 {
9657 // Get talent aura from owner
9658 if (IsPet())
9659 if (Unit* owner = GetOwner())
9660 {
9661 if (HasSpellCooldown(trigger_spell_id))
9662 return false;
9663 AddSpellCooldown(trigger_spell_id, 0, cooldown);
9664
9665 if (AuraEffect* aurEff = owner->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, 3220, 0))
9666 {
9667 int32 spellPower = owner->SpellBaseDamageBonusDone(SpellSchoolMask(SPELL_SCHOOL_MASK_MAGIC));
9668 if (AuraEffect const* demonicAuraEffect = GetAuraEffect(trigger_spell_id, EFFECT_0))
9669 spellPower -= demonicAuraEffect->GetAmount();
9670
9671 basepoints0 = int32((aurEff->GetAmount() * spellPower + 100.0f) / 100.0f);
9672 CastCustomSpell(this, trigger_spell_id, &basepoints0, &basepoints0, nullptr, true, castItem, triggeredByAura);
9673 return true;
9674 }
9675 }
9676 break;
9677 }
9678 case 46916: // Slam! (Bloodsurge proc)
9679 case 52437: // Sudden Death
9680 {
9681 // Item - Warrior T10 Melee 4P Bonus
9682 if (AuraEffect const* aurEff = GetAuraEffect(70847, 0))
9683 {
9684 if (!roll_chance_i(aurEff->GetAmount()))
9685 {
9686 // Xinef: dont allow normal proc to override set one
9687 if (GetAura((trigger_spell_id == 46916) ? 71072 : 71069))
9688 return false;
9689 // Xinef: just to be sure
9690 RemoveAurasDueToSpell(70849);
9691 break;
9692 }
9693
9694 // Xinef: fully remove all auras and reapply once more
9695 RemoveAurasDueToSpell(70849);
9696 RemoveAurasDueToSpell(71072);
9697 RemoveAurasDueToSpell(71069);
9698
9699 CastSpell(this, 70849, true, castItem, triggeredByAura); // Extra Charge!
9700 if (trigger_spell_id == 46916)
9701 CastSpell(this, 71072, true, castItem, triggeredByAura); // Slam GCD Reduced
9702 else
9703 CastSpell(this, 71069, true, castItem, triggeredByAura); // Execute GCD Reduced
9704 }
9705 break;
9706 }
9707 // Sword and Board
9708 case 50227:
9709 {
9710 // Remove cooldown on Shield Slam
9711 if (GetTypeId() == TYPEID_PLAYER)
9713 break;
9714 }
9715 // Maelstrom Weapon
9716 case 53817:
9717 {
9718 // have rank dependent proc chance, ignore too often cases
9719 // PPM = 2.5 * (rank of talent),
9720 uint32 rank = auraSpellInfo->GetRank();
9721 // 5 rank -> 100% 4 rank -> 80% and etc from full rate
9722 if (!roll_chance_i(20 * rank))
9723 return false;
9724
9725 // Item - Shaman T10 Enhancement 4P Bonus
9726 if (AuraEffect const* aurEff = GetAuraEffect(70832, 0))
9727 if (Aura const* maelstrom = GetAura(53817))
9728 // xinef: we have 4 charges and all proc conditions are met - aura reaches 5 charges
9729 if ((maelstrom->GetStackAmount() == 4) && roll_chance_i(aurEff->GetAmount()))
9730 CastSpell(this, 70831, true, castItem, triggeredByAura);
9731
9732 break;
9733 }
9734 // Astral Shift
9735 case 52179:
9736 {
9737 if (!procSpell || !(procEx & (PROC_EX_NORMAL_HIT | PROC_EX_CRITICAL_HIT)) || this == victim)
9738 return false;
9739
9740 // Need stun, fear or silence mechanic
9741 if (!(procSpell->GetAllEffectsMechanicMask() & ((1 << MECHANIC_SILENCE) | (1 << MECHANIC_STUN) | (1 << MECHANIC_FEAR))))
9742 return false;
9743 break;
9744 }
9745 // Glyph of Death's Embrace
9746 case 58679:
9747 {
9748 // Proc only from healing part of Death Coil. Check is essential as all Death Coil spells have 0x2000 mask in SpellFamilyFlags
9749 if (!procSpell || !(procSpell->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && procSpell->SpellFamilyFlags[0] == 0x80002000))
9750 return false;
9751 break;
9752 }
9753 // Glyph of Death Grip
9754 case 58628:
9755 {
9756 // remove cooldown of Death Grip
9757 if (GetTypeId() == TYPEID_PLAYER)
9758 ToPlayer()->RemoveSpellCooldown(49576, true);
9759 return true;
9760 }
9761 // Savage Defense
9762 case 62606:
9763 {
9764 basepoints0 = CalculatePct(triggerAmount, GetTotalAttackPowerValue(BASE_ATTACK));
9765 break;
9766 }
9767 // Body and Soul
9768 case 64128:
9769 case 65081:
9770 {
9771 // Proc only from PW:S cast
9772 if (!procSpell || !(procSpell->SpellFamilyFlags[0] & 0x00000001))
9773 return false;
9774 break;
9775 }
9776 // Culling the Herd
9777 case 70893:
9778 {
9779 if (!procSpell)
9780 {
9781 return false;
9782 }
9783 // check if we're doing a critical hit
9784 if (!(procSpell->SpellFamilyFlags[1] & 0x10000000) && (procEx != PROC_EX_CRITICAL_HIT))
9785 return false;
9786 // check if we're procced by Claw, Bite or Smack (need to use the spell icon ID to detect it)
9787 if (!(procSpell->SpellIconID == 262 || procSpell->SpellIconID == 1680 || procSpell->SpellIconID == 473))
9788 return false;
9789 break;
9790 }
9791 // Fingers of Frost, synchronise with Frostbite
9792 case 44544:
9793 {
9794 if (procPhase == PROC_SPELL_PHASE_HIT)
9795 {
9796 // Find Frostbite
9798 {
9799 if (!victim)
9800 return false;
9801
9802 uint8 fofRank = sSpellMgr->GetSpellRank(triggeredByAura->GetId());
9803 uint8 fbRank = sSpellMgr->GetSpellRank(aurEff->GetId());
9804 uint8 chance = uint8(std::ceil(fofRank * fbRank * 16.6f));
9805
9806 if (roll_chance_i(chance))
9807 CastSpell(victim, aurEff->GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, true);
9808 }
9809 }
9810 break;
9811 }
9812 }
9813
9814 // try detect target manually if not set
9815 if (!target)
9816 target = !(procFlags & (PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS)) && triggerEntry->IsPositive() ? this : victim;
9817
9818 if (cooldown)
9819 {
9820 if (HasSpellCooldown(triggerEntry->Id))
9821 return false;
9822
9823 AddSpellCooldown(triggerEntry->Id, 0, cooldown);
9824 }
9825
9826 if(basepoints0)
9827 CastCustomSpell(target, triggerEntry->Id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura);
9828 else
9829 CastSpell(target, triggerEntry->Id, true, castItem, triggeredByAura);
9830
9831 return true;
9832}
#define SUMMON_SLOT_MINIPET
Definition: Unit.h:1213
@ FORM_MOONKIN
Definition: Unit.h:119
@ FORM_NONE
Definition: Unit.h:90
@ FORM_TREE
Definition: Unit.h:92
@ SPELL_HACK_AND_SLASH
Definition: Unit.h:723
@ SPELL_SWORD_SPECIALIZATION
Definition: Unit.h:722
@ SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE
Definition: SpellAuraDefines.h:294
@ SPELL_AURA_ADD_TARGET_TRIGGER
Definition: SpellAuraDefines.h:172
@ PROC_SPELL_PHASE_HIT
Definition: SpellMgr.h:244
@ SPELL_EFFECT_ADD_EXTRA_ATTACKS
Definition: SharedDefines.h:769
@ SPELL_ATTR1_NO_THREAT
Definition: SharedDefines.h:401
@ MECHANIC_FEAR
Definition: SharedDefines.h:1302
@ MECHANIC_SILENCE
Definition: SharedDefines.h:1306
@ AURA_STATE_HEALTHLESS_35_PERCENT
Definition: SharedDefines.h:1277
@ SPELL_SCHOOL_MASK_MAGIC
Definition: SharedDefines.h:284
Creature * GetCreature(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:215
void ModifyThreatByPercent(Unit *victim, int32 percent)
Definition: ThreatMgr.cpp:509
bool HasMechanicTemplateImmunity(uint32 mask) const
Definition: Creature.cpp:2137
bool IsBaseRuneSlotsOnCooldown(RuneType runeType) const
Definition: Player.cpp:13367
void RemoveCategoryCooldown(uint32 cat)
Definition: Player.cpp:3470
Spell const * GetProcSpell() const
Definition: Unit.h:867
Unit * GetActor()
Definition: Unit.h:858
bool HealthAbovePct(int32 pct) const
Definition: Unit.h:1446
float GetTotalAttackPowerValue(WeaponAttackType attType, Unit *pVictim=nullptr) const
Definition: Unit.cpp:15315
uint32 GetLastExtraAttackSpell() const
Definition: Unit.h:1570
uint32 GetCreateHealth() const
Definition: Unit.h:2039
Unit * GetComboTarget() const
Definition: Unit.h:2292
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:1445
uint32 ManaCostPercentage
Definition: SpellInfo.h:365
bool HasEffect(SpellEffects effect) const
Definition: SpellInfo.cpp:869
uint32 ManaCost
Definition: SpellInfo.h:361

References Player::AddSpellCooldown(), AddSpellCooldown(), AURA_STATE_HEALTHLESS_35_PERCENT, BASE_ATTACK, CalculatePct(), CastCustomSpell(), CastDelayedSpellWithPeriodicAmount(), CastSpell(), CLASS_DEATH_KNIGHT, CLASS_DRUID, CLASS_PALADIN, CLASS_PRIEST, CLASS_SHAMAN, CountPctFromMaxHealth(), EFFECT_0, SpellInfo::Effects, FORM_BEAR, FORM_CAT, FORM_DIREBEAR, FORM_MOONKIN, FORM_NONE, FORM_TREE, ProcEventInfo::GetActor(), SpellInfo::GetAllEffectsMechanicMask(), AuraEffect::GetAmount(), GetAura(), GetAuraEffect(), AuraEffect::GetAuraType(), AuraEffect::GetBase(), Aura::GetCaster(), Aura::GetCastItemGUID(), getClass(), GetComboTarget(), GetCreateHealth(), GetCreateMana(), ObjectAccessor::GetCreature(), AuraEffect::GetEffIndex(), Object::GetEntry(), GetFirstSchoolInMask(), Object::GetFloatValue(), Object::GetGUID(), AuraEffect::GetId(), Player::GetItemByGuid(), GetLastExtraAttackSpell(), SpellInfo::GetMaxDuration(), GetOwner(), Player::GetPet(), ProcEventInfo::GetProcSpell(), SpellInfo::GetRank(), SpellInfo::GetSchoolMask(), GetShapeshiftForm(), AuraEffect::GetSpellInfo(), Aura::GetStackAmount(), GetStat(), GetThreatMgr(), GetTotalAttackPowerValue(), Object::GetTypeId(), SpellInfo::HasAttribute(), HasAura(), HasAuraState(), SpellInfo::HasEffect(), Creature::HasMechanicTemplateImmunity(), HasSpellCooldown(), HealthAbovePct(), HealthBelowPct(), HealthBelowPctDamaged(), SpellInfo::Id, IsAlive(), Player::IsBaseRuneSlotsOnCooldown(), IsPet(), SpellInfo::IsPositive(), LOG_ERROR, m_SummonSlot, SpellInfo::ManaCost, SpellInfo::ManaCostPercentage, SpellInfo::ManaCostPerlevel, MAX_RUNES, MECHANIC_FEAR, MECHANIC_SILENCE, MECHANIC_STUN, ThreatMgr::ModifyThreatByPercent(), POWER_MANA, SpellInfo::PowerType, PROC_EX_CRITICAL_HIT, PROC_EX_NORMAL_HIT, PROC_FLAG_DONE_OFFHAND_ATTACK, PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS, PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS, PROC_SPELL_PHASE_HIT, RemoveAurasDueToSpell(), Player::RemoveCategoryCooldown(), Player::RemoveSpellCooldown(), roll_chance_i(), RUNE_BLOOD, SPELL_ATTR1_NO_THREAT, SPELL_AURA_ADD_TARGET_TRIGGER, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE, SPELL_EFFECT_ADD_EXTRA_ATTACKS, SPELL_HACK_AND_SLASH, SPELL_SCHOOL_ARCANE, SPELL_SCHOOL_FIRE, SPELL_SCHOOL_FROST, SPELL_SCHOOL_HOLY, SPELL_SCHOOL_MASK_MAGIC, SPELL_SCHOOL_NATURE, SPELL_SCHOOL_NORMAL, SPELL_SCHOOL_SHADOW, SPELL_SWORD_SPECIALIZATION, SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_DRUID, SPELLFAMILY_GENERIC, SPELLFAMILY_HUNTER, SPELLFAMILY_MAGE, SPELLFAMILY_PALADIN, SPELLFAMILY_PRIEST, SPELLFAMILY_SHAMAN, SPELLFAMILY_WARLOCK, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, sSpellMgr, STAT_AGILITY, STAT_INTELLECT, STAT_SPIRIT, STAT_STRENGTH, SUMMON_SLOT_MINIPET, Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, UNIT_FIELD_MAXDAMAGE, UNIT_FIELD_MAXOFFHANDDAMAGE, UNIT_FIELD_MINDAMAGE, and UNIT_FIELD_MINOFFHANDDAMAGE.

Referenced by ProcDamageAndSpellFor().

◆ HandleSafeUnitPointersOnDelete()

void Unit::HandleSafeUnitPointersOnDelete ( Unit thisUnit)
static
4270{
4271 if (thisUnit->SafeUnitPointerSet.empty())
4272 return;
4273 for (std::set<SafeUnitPointer*>::iterator itr = thisUnit->SafeUnitPointerSet.begin(); itr != thisUnit->SafeUnitPointerSet.end(); ++itr)
4274 (*itr)->UnitDeleted();
4275
4276 thisUnit->SafeUnitPointerSet.clear();
4277}

References SafeUnitPointerSet.

Referenced by ~Unit().

◆ HandleSpellClick()

bool Unit::HandleSpellClick ( Unit clicker,
int8  seatId = -1 
)

First check simple relations from clicker to clickee

Check database conditions

19684{
19685 Creature* creature = ToCreature();
19686 if (creature && creature->IsAIEnabled)
19687 {
19688 if (!creature->AI()->BeforeSpellClick(clicker))
19689 {
19690 return false;
19691 }
19692 }
19693
19694 bool result = false;
19695 uint32 spellClickEntry = GetVehicleKit() ? GetVehicleKit()->GetCreatureEntry() : GetEntry();
19696 SpellClickInfoMapBounds clickPair = sObjectMgr->GetSpellClickInfoMapBounds(spellClickEntry);
19697 for (SpellClickInfoContainer::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
19698 {
19700 if (!itr->second.IsFitToRequirements(clicker, this))
19701 continue;
19702
19704 ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(spellClickEntry, itr->second.spellId);
19705 ConditionSourceInfo info = ConditionSourceInfo(clicker, this);
19706 if (!sConditionMgr->IsObjectMeetToConditions(info, conds))
19707 continue;
19708
19709 Unit* caster = (itr->second.castFlags & NPC_CLICK_CAST_CASTER_CLICKER) ? clicker : this;
19710 Unit* target = (itr->second.castFlags & NPC_CLICK_CAST_TARGET_CLICKER) ? clicker : this;
19711 ObjectGuid origCasterGUID = (itr->second.castFlags & NPC_CLICK_CAST_ORIG_CASTER_OWNER) ? GetOwnerGUID() : clicker->GetGUID();
19712
19713 SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(itr->second.spellId);
19714
19715 // xinef: dont allow players to enter vehicles on arena
19716 if (spellEntry->HasAura(SPELL_AURA_CONTROL_VEHICLE) && caster->GetTypeId() == TYPEID_PLAYER && caster->FindMap() && caster->FindMap()->IsBattleArena())
19717 continue;
19718
19719 if (seatId > -1)
19720 {
19721 uint8 i = 0;
19722 bool valid = false;
19723 while (i < MAX_SPELL_EFFECTS)
19724 {
19725 if (spellEntry->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE)
19726 {
19727 valid = true;
19728 break;
19729 }
19730 ++i;
19731 }
19732
19733 if (!valid)
19734 {
19735 LOG_ERROR("sql.sql", "Spell {} specified in npc_spellclick_spells is not a valid vehicle enter aura!", itr->second.spellId);
19736 continue;
19737 }
19738
19739 if (IsInMap(caster))
19740 caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0 + i), seatId + 1, target, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, nullptr, nullptr, origCasterGUID);
19741 else // This can happen during Player::_LoadAuras
19742 {
19744 for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
19745 bp0[j] = spellEntry->Effects[j].BasePoints;
19746
19747 bp0[i] = seatId;
19748 Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, bp0, nullptr, origCasterGUID);
19749 }
19750 }
19751 else
19752 {
19753 if (IsInMap(caster))
19754 caster->CastSpell(target, spellEntry, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, nullptr, nullptr, origCasterGUID);
19755 else
19756 Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, nullptr, nullptr, origCasterGUID);
19757 }
19758
19759 result = true;
19760 }
19761
19762 if (creature && creature->IsAIEnabled)
19763 creature->AI()->OnSpellClick(clicker, result);
19764
19765 return result;
19766}
#define sConditionMgr
Definition: ConditionMgr.h:289
std::list< Condition * > ConditionList
Definition: ConditionMgr.h:236
std::pair< SpellClickInfoContainer::const_iterator, SpellClickInfoContainer::const_iterator > SpellClickInfoMapBounds
Definition: ObjectMgr.h:409
SpellValueMod
Definition: SpellDefines.h:113
@ NPC_CLICK_CAST_TARGET_CLICKER
Definition: SharedDefines.h:663
@ NPC_CLICK_CAST_ORIG_CASTER_OWNER
Definition: SharedDefines.h:664
@ NPC_CLICK_CAST_CASTER_CLICKER
Definition: SharedDefines.h:662
virtual void OnSpellClick(Unit *, bool &)
Definition: CreatureAI.h:195
virtual bool BeforeSpellClick(Unit *)
Definition: CreatureAI.h:193
Definition: ConditionMgr.h:181
uint32 GetCreatureEntry() const
Definition: Vehicle.h:41
bool HasAura(AuraType aura) const
Definition: SpellInfo.cpp:877

References Creature::AI(), CreatureAI::BeforeSpellClick(), CastCustomSpell(), CastSpell(), SpellInfo::Effects, WorldObject::FindMap(), Vehicle::GetCreatureEntry(), Object::GetEntry(), Object::GetGUID(), GetOwnerGUID(), Object::GetTypeId(), GetVehicleKit(), SpellInfo::HasAura(), IsAIEnabled, Map::IsBattleArena(), WorldObject::IsInMap(), LOG_ERROR, MAX_EFFECT_MASK, MAX_SPELL_EFFECTS, NPC_CLICK_CAST_CASTER_CLICKER, NPC_CLICK_CAST_ORIG_CASTER_OWNER, NPC_CLICK_CAST_TARGET_CLICKER, CreatureAI::OnSpellClick(), sConditionMgr, sObjectMgr, SPELL_AURA_CONTROL_VEHICLE, SPELLVALUE_BASE_POINT0, sSpellMgr, Object::ToCreature(), TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE, TRIGGERED_NONE, Aura::TryRefreshStackOrCreate(), and TYPEID_PLAYER.

Referenced by boss_xt002::boss_xt002AI::AttachHeart(), boss_kologarn::boss_kologarnAI::AttachLeftArm(), boss_kologarn::boss_kologarnAI::AttachRightArm(), WorldSession::HandleSpellClick(), Vehicle::InstallAccessory(), and npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI().

◆ HandleStatModifier()

bool Unit::HandleStatModifier ( UnitMods  unitMod,
UnitModifierType  modifierType,
float  amount,
bool  apply 
)
15091{
15092 if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END)
15093 {
15094 LOG_ERROR("entities.unit", "ERROR in HandleStatModifier(): non-existing UnitMods or wrong UnitModifierType!");
15095 return false;
15096 }
15097
15098 switch (modifierType)
15099 {
15100 case BASE_VALUE:
15101 case TOTAL_VALUE:
15102 m_auraModifiersGroup[unitMod][modifierType] += apply ? amount : -amount;
15103 break;
15104 case BASE_PCT:
15105 case TOTAL_PCT:
15106 ApplyPercentModFloatVar(m_auraModifiersGroup[unitMod][modifierType], amount, apply);
15107 break;
15108 default:
15109 break;
15110 }
15111
15112 if (!CanModifyStats())
15113 return false;
15114
15115 switch (unitMod)
15116 {
15123 break;
15124
15125 case UNIT_MOD_ARMOR:
15126 UpdateArmor();
15127 break;
15128 case UNIT_MOD_HEALTH:
15130 break;
15131
15132 case UNIT_MOD_MANA:
15133 case UNIT_MOD_RAGE:
15134 case UNIT_MOD_FOCUS:
15135 case UNIT_MOD_ENERGY:
15136 case UNIT_MOD_HAPPINESS:
15137 case UNIT_MOD_RUNE:
15140 break;
15141
15149 break;
15150
15153 break;
15156 break;
15157
15160 break;
15163 break;
15166 break;
15167
15168 default:
15169 break;
15170 }
15171
15172 return true;
15173}
@ UNIT_MOD_ARMOR
Definition: Unit.h:275
@ UNIT_MOD_ATTACK_POWER
Definition: Unit.h:282
@ UNIT_MOD_HEALTH
Definition: Unit.h:267
@ UNIT_MOD_DAMAGE_RANGED
Definition: Unit.h:286
@ UNIT_MOD_DAMAGE_MAINHAND
Definition: Unit.h:284
@ UNIT_MOD_ATTACK_POWER_RANGED
Definition: Unit.h:283
void apply(T *val)
Definition: ByteConverter.h:40
SpellSchools GetSpellSchoolByAuraGroup(UnitMods unitMod) const
Definition: Unit.cpp:15232
Stats GetStatByAuraGroup(UnitMods unitMod) const
Definition: Unit.cpp:15264
virtual void UpdateAttackPowerAndDamage(bool ranged=false)=0
virtual void UpdateResistances(uint32 school)=0
Powers GetPowerTypeByAuraGroup(UnitMods unitMod) const
Definition: Unit.cpp:15293
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition: StatSystem.cpp:60
virtual void UpdateArmor()=0
virtual void UpdateMaxPower(Powers power)=0
virtual bool UpdateStats(Stats stat)=0
bool CanModifyStats() const
Definition: Unit.h:2105
virtual void UpdateMaxHealth()=0

References ApplyPercentModFloatVar(), BASE_ATTACK, BASE_PCT, BASE_VALUE, CanModifyStats(), GetPowerTypeByAuraGroup(), GetSpellSchoolByAuraGroup(), GetStatByAuraGroup(), LOG_ERROR, m_auraModifiersGroup, MODIFIER_TYPE_END, OFF_ATTACK, RANGED_ATTACK, TOTAL_PCT, TOTAL_VALUE, UNIT_MOD_ARMOR, UNIT_MOD_ATTACK_POWER, UNIT_MOD_ATTACK_POWER_RANGED, UNIT_MOD_DAMAGE_MAINHAND, UNIT_MOD_DAMAGE_OFFHAND, UNIT_MOD_DAMAGE_RANGED, UNIT_MOD_END, UNIT_MOD_ENERGY, UNIT_MOD_FOCUS, UNIT_MOD_HAPPINESS, UNIT_MOD_HEALTH, UNIT_MOD_MANA, UNIT_MOD_RAGE, UNIT_MOD_RESISTANCE_ARCANE, UNIT_MOD_RESISTANCE_FIRE, UNIT_MOD_RESISTANCE_FROST, UNIT_MOD_RESISTANCE_HOLY, UNIT_MOD_RESISTANCE_NATURE, UNIT_MOD_RESISTANCE_SHADOW, UNIT_MOD_RUNE, UNIT_MOD_RUNIC_POWER, UNIT_MOD_STAT_AGILITY, UNIT_MOD_STAT_INTELLECT, UNIT_MOD_STAT_SPIRIT, UNIT_MOD_STAT_STAMINA, UNIT_MOD_STAT_STRENGTH, UpdateArmor(), UpdateAttackPowerAndDamage(), UpdateDamagePhysical(), UpdateMaxHealth(), UpdateMaxPower(), UpdateResistances(), and UpdateStats().

Referenced by Player::_ApplyItemBonuses(), Player::_ApplyWeaponDependentAuraDamageMod(), Player::ApplyEnchantment(), AuraEffect::HandleAuraIncreaseBaseHealthPercent(), AuraEffect::HandleAuraModAttackPower(), AuraEffect::HandleAuraModAttackPowerPercent(), AuraEffect::HandleAuraModBaseResistancePCT(), AuraEffect::HandleAuraModIncreaseEnergy(), AuraEffect::HandleAuraModIncreaseEnergyPercent(), AuraEffect::HandleAuraModIncreaseHealth(), AuraEffect::HandleAuraModIncreaseHealthPercent(), AuraEffect::HandleAuraModIncreaseMaxHealth(), AuraEffect::HandleAuraModRangedAttackPower(), AuraEffect::HandleAuraModRangedAttackPowerPercent(), AuraEffect::HandleAuraModResistance(), AuraEffect::HandleAuraModResistanceExclusive(), AuraEffect::HandleAuraModStat(), AuraEffect::HandleModBaseResistance(), AuraEffect::HandleModDamageDone(), AuraEffect::HandleModDamagePercentDone(), AuraEffect::HandleModOffhandDamagePercent(), AuraEffect::HandleModPercentStat(), AuraEffect::HandleModResistancePercent(), AuraEffect::HandleModTotalPercentStat(), Guardian::InitStatsForLevel(), spell_astromancer_solarian_transform::spell_astromancer_solarian_transform_AuraScript::OnApply(), spell_astromancer_solarian_transform::spell_astromancer_solarian_transform_AuraScript::OnRemove(), boss_arlokk::boss_arlokkAI::Reset(), boss_marli::Reset(), boss_arlokk::boss_arlokkAI::UpdateAI(), and boss_marli::UpdateAI().

◆ HasAura()

bool Unit::HasAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0 
) const
5611{
5612 if (GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask))
5613 return true;
5614 return false;
5615}

References GetAuraApplication().

Referenced by boss_grand_champion::boss_grand_championAI::AddCreatureAddonAuras(), Pet::AddToWorld(), spell_warl_health_funnel::ApplyEffect(), boss_archavon::boss_archavonAI::AttackStart(), boss_emalon::boss_emalonAI::AttackStart(), boss_koralon::boss_koralonAI::AttackStart(), boss_toravon::boss_toravonAI::AttackStart(), boss_hodir::boss_hodirAI::CanAIAttack(), boss_razorgore::boss_razorgoreAI::CanAIAttack(), boss_hazzarah::CanAIAttack(), boss_jindo::CanAIAttack(), boss_renataki::boss_renatakiAI::CanAIAttack(), boss_chromaggus::boss_chromaggusAI::CanAIAttack(), npc_wg_siege_machine::npc_wg_siege_machineAI::CanControlVehicle(), Player::CanJoinToBattleground(), Player::CanResummonPet(), Player::CanUseAmmo(), Player::CanUseBattlegroundObject(), spell_hun_pet_heart_of_the_phoenix::CheckCast(), Spell::CheckCast(), Spell::CheckCasterAuras(), Spell::CheckItems(), spell_pal_hand_of_sacrifice::CheckTarget(), SpellInfo::CheckTarget(), spell_hun_lock_and_load::CheckTrapProc(), npc_mc_core_hound::npc_mc_core_houndAI::DamageTaken(), boss_thekal::boss_thekalAI::DamageTaken(), boss_sartharion::boss_sartharionAI::DamageTaken(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DamageTaken(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DamageTaken(), boss_razorscale::boss_razorscaleAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), npc_kinetic_bomb::npc_kinetic_bombAI::DoAction(), boss_kalecgos::boss_kalecgosAI::DoAction(), Spell::DoCreateItem(), Spell::EffectDummy(), Spell::EffectHeal(), Spell::EffectInstaKill(), Spell::EffectSanctuary(), Spell::EffectSchoolDMG(), Spell::EffectScriptEffect(), Spell::EffectSummonPlayer(), Spell::EffectTriggerSpell(), Spell::EffectWeaponDmg(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterCombat(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterCombat(), boss_bjarngrim::boss_bjarngrimAI::EnterCombat(), boss_freya_elder_stonebark::boss_freya_elder_stonebarkAI::EnterCombat(), boss_freya_elder_brightleaf::boss_freya_elder_brightleafAI::EnterCombat(), boss_freya_elder_ironbranch::boss_freya_elder_ironbranchAI::EnterCombat(), npc_hivezara_stinger::EnterCombat(), npc_vekniss_stinger::EnterCombat(), NPCStaveQuestAI::EvadeOnFeignDeath(), IceTombSummonEvent::Execute(), PartyTimeEmoteEvent::Execute(), spell_class_call_polymorph::FilterTargets(), spell_dru_wild_growth::FilterTargets(), spell_pri_circle_of_healing::FilterTargets(), lfg::LFGMgr::FinishDungeon(), GetDispellableAuraList(), instance_sunwell_plateau::instance_sunwell_plateau_InstanceMapScript::GetPlayerInMap(), Player::GetResurrectionSpellId(), Player::GiveXP(), go_wind_stone::go_wind_stoneAI::GossipHello(), spell_dk_scourge_strike::HandleAfterHit(), spell_dru_enrage::HandleApply(), BattlegroundDS::HandleAreaTrigger(), OutdoorPvPSI::HandleAreaTrigger(), AuraEffect::HandleAuraMounted(), Aura::HandleAuraSpecificMods(), WorldSession::HandleBattleFieldPortOpcode(), spell_thaddius_pos_neg_charge::spell_thaddius_pos_neg_charge_SpellScript::HandleDamage(), spell_capacitus_polarity_charge::spell_capacitus_polarity_charge_SpellScript::HandleDamage(), spell_mage_summon_water_elemental::HandleDummy(), spell_rog_preparation::HandleDummy(), spell_warr_charge::HandleDummy(), HandleDummyAuraProc(), spell_q12851_going_bearback::HandleEffectApply(), spell_dk_improved_blood_presence::HandleEffectApply(), spell_dk_improved_frost_presence::HandleEffectApply(), spell_dk_improved_unholy_presence::HandleEffectApply(), spell_oculus_soar::spell_oculus_soarAuraScript::HandleEffectPeriodic(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), spell_dk_improved_blood_presence::HandleEffectRemove(), spell_dk_improved_frost_presence::HandleEffectRemove(), spell_dk_improved_unholy_presence::HandleEffectRemove(), Player::HandleFall(), gm_commandscript::HandleGMVisibleCommand(), spell_dk_presence::HandleImprovedBloodPresence(), spell_dk_presence::HandleImprovedFrostPresence(), spell_dk_presence::HandleImprovedUnholyPresence(), spell_sindragosa_frost_breath::spell_sindragosa_frost_breath_SpellScript::HandleInfusion(), BattlefieldWG::HandleKill(), lookup_commandscript::HandleLookupSpellCommand(), lookup_commandscript::HandleLookupSpellIdCommand(), WorldSession::HandleMessagechatOpcode(), spell_oculus_soar::spell_oculus_soarAuraScript::HandleOnEffectApply(), spell_mark_of_frost_freeze::HandleOnHit(), OPvPCapturePointZM_GraveYard::HandleOpenGo(), spell_hadronox_summon_periodic::spell_hadronox_summon_periodic_AuraScript::HandlePeriodic(), spell_garr_separation_nexiety::spell_garr_separation_nexiety_AuraScript::HandlePeriodic(), spell_majordomo_separation_nexiety::spell_majordomo_separation_nexiety_AuraScript::HandlePeriodic(), spell_dk_blood_caked_blade::HandleProc(), HandleProcTriggerSpell(), spell_warr_vigilance::HandleRemove(), spell_najentus_hurl_spine::spell_najentus_hurl_spine_SpellScript::HandleSchoolDamage(), spell_pal_lay_on_hands::HandleScript(), spell_hun_pet_heart_of_the_phoenix::HandleScript(), spell_q12611_deathbolt::HandleScriptEffect(), spell_dru_glyph_of_starfire::HandleScriptEffect(), misc_commandscript::HandleUnFreezeCommand(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::InformCloud(), boss_taldaram::InitializeAI(), Player::IsDeserter(), SpellArea::IsFitToRequirements(), go_wg_vehicle_teleporter::go_wg_vehicle_teleporterAI::IsValidVehicle(), IsVampire(), lfg::LFGMgr::JoinLfg(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::JustDied(), boss_professor_putricide::boss_professor_putricideAI::JustDied(), boss_sindragosa::boss_sindragosaAI::JustDied(), boss_hydross_the_unstable::boss_hydross_the_unstableAI::JustDied(), boss_alar::boss_alarAI::JustDied(), boss_hydross_the_unstable::boss_hydross_the_unstableAI::JustReachedHome(), Kill(), boss_hydross_the_unstable::boss_hydross_the_unstableAI::KilledUnit(), boss_hadronox::boss_hadronoxAI::KilledUnit(), Creature::LoadCreaturesAddon(), MeleeDamageBonusDone(), ModSpellCastTime(), npc_love_in_air_supply_sentry::MoveInLineOfSight(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::MoveInLineOfSight(), npc_custodian_of_time::npc_custodian_of_timeAI::MoveInLineOfSight(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::MoveInLineOfSight(), npc_guardian_pavilion::npc_guardian_pavilionAI::MoveInLineOfSight(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::MoveInLineOfSight(), boss_doomwalker::boss_doomwalkerAI::MoveInLineOfSight(), npc_daranelle::npc_daranelleAI::MoveInLineOfSight(), boss_kagani_nightstrike::boss_kagani_nightstrikeAI::MovementInform(), achievement_staying_buffed_all_winter_10::OnCheck(), achievement_staying_buffed_all_winter_25::OnCheck(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), npc_pet_gen_argent_pony_bridle::OnGossipHello(), npc_parqual_fintallas::OnGossipHello(), npc_aged_dying_ancient_kodo::OnGossipHello(), npc_alchemist_adrianna::OnGossipHello(), npc_wg_demolisher_engineer::OnGossipHello(), npc_innkeeper::OnGossipHello(), go_orb_of_domination::OnGossipHello(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npc_innkeeper::OnGossipSelect(), spell_love_is_in_the_air_romantic_picnic::OnPeriodic(), instance_scarlet_monastery::instance_scarlet_monastery_InstanceMapScript::OnPlayerAreaUpdate(), instance_scarlet_monastery::instance_scarlet_monastery_InstanceMapScript::OnPlayerEnter(), spell_azjol_nerub_web_wrap::spell_azjol_nerub_web_wrap_AuraScript::OnRemove(), spell_icc_web_wrap::spell_icc_web_wrap_AuraScript::OnRemove(), spell_gen_damage_reduction_aura::OnRemove(), at_hor_battered_hilt_start::OnTrigger(), at_hor_battered_hilt_throw::OnTrigger(), AreaTrigger_at_nats_landing::OnTrigger(), at_bring_your_orphan_to::OnTrigger(), at_commander_dawnforge::OnTrigger(), item_gor_dreks_ointment::OnUse(), Acore::FriendlyMissingBuffInRange::operator()(), NotInStomachSelector::operator()(), SindragosaIceTombCheck::operator()(), NecroticPlagueTargetCheck::operator()(), DefaultTargetSelector::operator()(), LastPhaseIceTombTargetSelector::operator()(), NonTankLKTargetSelector::operator()(), DefileTargetSelector::operator()(), ShadowOfDeathSelector::operator()(), Acore::UnitAuraCheck::operator()(), SpectralBlastCheck::operator()(), npc_wild_wyrm::npc_wild_wyrmAI::PassengerBoarded(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), npc_dancing_flames::npc_dancing_flamesAI::ReceiveEmote(), Player::ReportedAfkBy(), npc_corrupted_totem::Reset(), npc_belnistrasz::npc_belnistraszAI::Reset(), boss_magus_telestra::boss_magus_telestraAI::Reset(), npc_pet_pri_shadowfiend::Reset(), Player::RewardHonor(), RewardRage(), npc_finklestein::npc_finklesteinAI::RightClickCauldron(), boss_jormungarAI::ScheduleEvents(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), Player::SendQuestUpdate(), npc_corrupted_totem::SetAura(), npc_ulduar_harpoonfirestate::npc_ulduar_harpoonfirestateAI::SetData(), boss_anomalus::boss_anomalusAI::SetData(), npc_thassarian2::npc_thassarian2AI::sGossipHello(), npc_omen::npc_omenAI::SpellHit(), npc_nelson::npc_nelsonAI::SpellHit(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::SpellHit(), boss_sister_svalna::boss_sister_svalnaAI::SpellHit(), boss_faerlina::boss_faerlinaAI::SpellHit(), boss_razorscale::boss_razorscaleAI::SpellHit(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::SpellHit(), npc_greengill_slave::npc_greengill_slaveAI::SpellHit(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::SpellHit(), SpellPctDamageModsDone(), SpellTakenCritChance(), Player::StoreItem(), boss_moam::SummonedCreatureDies(), boss_apothecary_hummel::boss_apothecary_hummelAI::SummonedCreatureDies(), boss_archimonde::boss_archimondeAI::UnleashSoulCharge(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), npc_mc_core_hound::npc_mc_core_houndAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::UpdateAI(), boss_nalorakk::boss_nalorakkAI::UpdateAI(), boss_hakkar::boss_hakkarAI::UpdateAI(), npc_abomination::npc_abominationAI::UpdateAI(), npc_onyxian_lair_guard::UpdateAI(), boss_moam::UpdateAI(), boss_ossirian::UpdateAI(), boss_elder_nadox::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_anubarak_spike::npc_anubarak_spikeAI::UpdateAI(), boss_novos::boss_novosAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), npc_ice_tomb::npc_ice_tombAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), boss_faerlina::boss_faerlinaAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_eregos::boss_eregosAI::UpdateAI(), boss_freya_elder_stonebark::boss_freya_elder_stonebarkAI::UpdateAI(), boss_vezax::boss_vezaxAI::UpdateAI(), npc_ulduar_hodir_priest::npc_ulduar_hodir_priestAI::UpdateAI(), npc_ulduar_hodir_druid::npc_ulduar_hodir_druidAI::UpdateAI(), npc_ulduar_hodir_shaman::npc_ulduar_hodir_shamanAI::UpdateAI(), npc_ulduar_hodir_mage::npc_ulduar_hodir_mageAI::UpdateAI(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::UpdateAI(), boss_thorim_gauntlet_npcs::boss_thorim_gauntlet_npcsAI::UpdateAI(), npc_ulduar_storm_tempered_keeper::npc_ulduar_storm_tempered_keeperAI::UpdateAI(), npc_beryl_sorcerer::npc_beryl_sorcererAI::UpdateAI(), npc_imprisoned_beryl_sorcerer::npc_imprisoned_beryl_sorcererAI::UpdateAI(), npc_lake_frog::npc_lake_frogAI::UpdateAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), boss_gurtogg_bloodboil::boss_gurtogg_bloodboilAI::UpdateAI(), boss_supremus::boss_supremusAI::UpdateAI(), boss_fathomlord_karathress::boss_fathomlord_karathressAI::UpdateAI(), boss_hydross_the_unstable::boss_hydross_the_unstableAI::UpdateAI(), boss_lady_vashj::boss_lady_vashjAI::UpdateAI(), socrethar::socretharAI::UpdateAI(), npc_phase_hunter::npc_phase_hunterAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), boss_ichoron::boss_ichoronAI::UpdateAI(), Player::UpdateAreaDependentAuras(), boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::UpdateEscortAI(), boss_netherspite::boss_netherspiteAI::UpdatePortals(), Player::UpdateZoneDependentAuras(), and Spell::WriteAmmoToPacket().

◆ HasAuraEffect()

bool Unit::HasAuraEffect ( uint32  spellId,
uint8  effIndex,
ObjectGuid  caster = ObjectGuid::Empty 
) const
5581{
5582 AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
5583 for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
5584 {
5585 if (itr->second->HasEffect(effIndex)
5586 && (!caster || itr->second->GetBase()->GetCasterGUID() == caster))
5587 {
5588 return true;
5589 }
5590 }
5591 return false;
5592}

References m_appliedAuras.

Referenced by Spell::CanAutoCast(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), spell_q12683_take_sputum_sample::HandleDummy(), AchievementCriteriaData::Meets(), and boss_headless_horseman::UpdateAI().

◆ HasAuraState()

bool Unit::HasAuraState ( AuraStateType  flag,
SpellInfo const *  spellProto = nullptr,
Unit const *  Caster = nullptr 
) const
10508{
10509 if (Caster)
10510 {
10511 if (spellProto)
10512 {
10513 AuraEffectList const& stateAuras = Caster->GetAuraEffectsByType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
10514 for (AuraEffectList::const_iterator j = stateAuras.begin(); j != stateAuras.end(); ++j)
10515 if ((*j)->IsAffectedOnSpell(spellProto))
10516 return true;
10517 }
10518 // Check per caster aura state
10519 // If aura with aurastate by caster not found return false
10520 if ((1 << (flag - 1)) & PER_CASTER_AURA_STATE_MASK)
10521 {
10522 AuraStateAurasMapBounds range = m_auraStateAuras.equal_range(flag);
10523 for (AuraStateAurasMap::const_iterator itr = range.first; itr != range.second; ++itr)
10524 if (itr->second->GetBase()->GetCasterGUID() == Caster->GetGUID())
10525 return true;
10526 return false;
10527 }
10528 }
10529
10530 return HasFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1));
10531}
@ SPELL_AURA_ABILITY_IGNORE_AURASTATE
Definition: SpellAuraDefines.h:325
std::pair< AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator > AuraStateAurasMapBounds
Definition: Unit.h:1304

References GetAuraEffectsByType(), Object::GetGUID(), Object::HasFlag(), m_auraStateAuras, PER_CASTER_AURA_STATE_MASK, SPELL_AURA_ABILITY_IGNORE_AURASTATE, and UNIT_FIELD_AURASTATE.

Referenced by Player::_addSpell(), Pet::addSpell(), Spell::CheckCast(), spell_sha_earthliving_weapon::CheckProc(), SpellInfo::CheckTarget(), ClearAllReactives(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), Spell::EffectWeaponDmg(), spell_warr_sweeping_strikes::HandleProc(), HandleProcTriggerSpell(), isFrozen(), Player::LoadFromDB(), MeleeDamageBonusDone(), SpellPctDamageModsDone(), SpellTakenCritChance(), and UpdateReactives().

◆ HasAuraType()

bool Unit::HasAuraType ( AuraType  auraType) const
5618{
5619 return (!m_modAuras[auraType].empty());
5620}

References m_modAuras.

Referenced by ApplyTotalThreatModifier(), Attack(), Creature::CanCreatureAttack(), Player::CanTameExoticPets(), spell_q11010_q11102_q11023_q11008_check_fly_mount::CheckRequirement(), SpellInfo::CheckTarget(), Creature::DoFleeToGetAssistance(), Spell::DoSpellHitOnUnit(), Player::DurabilityPointsLoss(), Spell::EffectStuck(), Spell::EffectWeaponDmg(), npc_wild_wyrm::npc_wild_wyrmAI::EnterEvadeMode(), spell_suppression_aura::FilterTargets(), Player::GetAurasForTarget(), Player::getMaxTimer(), AuraEffect::HandleArenaPreparation(), AuraEffect::HandleAuraAllowFlight(), AuraEffect::HandleAuraAllowOnlyAbility(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraEmpathy(), AuraEffect::HandleAuraFeatherFall(), AuraEffect::HandleAuraGhost(), AuraEffect::HandleAuraHover(), AuraEffect::HandleAuraModDisarm(), AuraEffect::HandleAuraModFakeInebriation(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), AuraEffect::HandleAuraModPacify(), AuraEffect::HandleAuraModPacifyAndSilence(), AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraModSilence(), AuraEffect::HandleAuraModStalked(), AuraEffect::HandleAuraTrackStealthed(), AuraEffect::HandleAuraUntrackable(), AuraEffect::HandleAuraWaterWalk(), AuraEffect::HandleComprehendLanguage(), AuraEffect::HandleDetectAmore(), spell_item_reindeer_transformation::HandleDummy(), spell_item_brewfest_mount_transformation::HandleDummy(), Player::HandleFall(), AuraEffect::HandleForceMoveForward(), WorldSession::HandleMirrorImageDataRequest(), AuraEffect::HandleModInvisibility(), AuraEffect::HandleModInvisibilityDetect(), AuraEffect::HandleModStealth(), AuraEffect::HandleModStealthDetect(), AuraEffect::HandleModUnattackable(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePlayerLoginFromDB(), AuraEffect::HandlePreventFleeing(), WorldSession::HandleRepopRequestOpcode(), reset_commandscript::HandleResetStatsOrLevelHelper(), WorldSession::HandleSelfResOpcode(), HasAuraTypeWithFamilyFlags(), HasInvisibilityAura(), HasStealthAura(), isFeared(), SpellArea::IsFitToRequirements(), IsImmunedToDamage(), IsImmunedToSchool(), IsImmunedToSpell(), IsImmunedToSpellEffect(), isInRoots(), isSpellBlocked(), Kill(), Player::KillPlayer(), KnockbackFrom(), Player::LoadFromDB(), WorldSession::LogoutPlayer(), MagicSpellHitResult(), MeleeDamageBonusTaken(), MeleeSpellHitResult(), Acore::AnyDeadUnitObjectInRangeCheck::operator()(), LastPhaseIceTombTargetSelector::operator()(), WorldSession::ReadMovementInfo(), Player::Regenerate(), Player::RegenerateAll(), Player::RegenerateHealth(), Player::RewardHonor(), RollMeleeOutcomeAgainst(), PetAI::SelectNextTarget(), Player::SendInitialPacketsAfterAddToMap(), SetControlled(), Player::SetDrunkValue(), SpellDamageBonusTaken(), SpellTakenCritChance(), Player::Update(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::UpdateAI(), npc_phase_hunter::npc_phase_hunterAI::UpdateAI(), Creature::UpdateMovementFlags(), and Player::UpdateTriggerVisibility().

◆ HasAuraTypeWithAffectMask()

bool Unit::HasAuraTypeWithAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
5651{
5652 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5653 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5654 if ((*i)->IsAffectedOnSpell(affectedSpell))
5655 return true;
5656 return false;
5657}

References GetAuraEffectsByType().

Referenced by AuraEffect::CalculatePeriodic(), Spell::DoSpellHitOnUnit(), Spell::handle_immediate(), Aura::RefreshDuration(), and Aura::RefreshTimersWithMods().

◆ HasAuraTypeWithCaster()

bool Unit::HasAuraTypeWithCaster ( AuraType  auratype,
ObjectGuid  caster 
) const
5623{
5624 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5625 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5626 if (caster == (*i)->GetCasterGUID())
5627 return true;
5628 return false;
5629}

References GetAuraEffectsByType().

Referenced by BuildValuesUpdate(), IsAlwaysDetectableFor(), and ThreatContainer::SelectNextVictim().

◆ HasAuraTypeWithFamilyFlags()

bool Unit::HasAuraTypeWithFamilyFlags ( AuraType  auraType,
uint32  familyName,
uint32  familyFlags 
) const
771{
772 if (!HasAuraType(auraType))
773 return false;
774 AuraEffectList const& auras = GetAuraEffectsByType(auraType);
775 for (AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
776 if (SpellInfo const* iterSpellProto = (*itr)->GetSpellInfo())
777 if (iterSpellProto->SpellFamilyName == familyName && iterSpellProto->SpellFamilyFlags[0] & familyFlags)
778 return true;
779 return false;
780}

References GetAuraEffectsByType(), and HasAuraType().

◆ HasAuraTypeWithMiscvalue()

bool Unit::HasAuraTypeWithMiscvalue ( AuraType  auratype,
int32  miscvalue 
) const
5642{
5643 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5644 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5645 if (miscvalue == (*i)->GetMiscValue())
5646 return true;
5647 return false;
5648}

References GetAuraEffectsByType().

Referenced by Player::Regenerate(), Player::UpdateManaRegen(), and Player::UpdateStats().

◆ HasAuraTypeWithTriggerSpell()

bool Unit::HasAuraTypeWithTriggerSpell ( AuraType  auratype,
uint32  triggerSpell 
) const
5669{
5670 for (AuraEffect const* aura : GetAuraEffectsByType(auratype))
5671 {
5672 if (aura->GetSpellInfo()->Effects[aura->GetEffIndex()].TriggerSpell == triggerSpell)
5673 {
5674 return true;
5675 }
5676 }
5677
5678 return false;
5679}

References GetAuraEffectsByType().

Referenced by WorldSession::HandlePetActionHelper().

◆ HasAuraTypeWithValue()

bool Unit::HasAuraTypeWithValue ( AuraType  auratype,
int32  value 
) const
5660{
5661 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5662 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5663 if (value == (*i)->GetAmount())
5664 return true;
5665 return false;
5666}

References GetAuraEffectsByType().

◆ HasAuraWithMechanic()

bool Unit::HasAuraWithMechanic ( uint32  mechanicMask) const
5705{
5706 for (AuraApplicationMap::const_iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter)
5707 {
5708 SpellInfo const* spellInfo = iter->second->GetBase()->GetSpellInfo();
5709 if (spellInfo->Mechanic && (mechanicMask & (1 << spellInfo->Mechanic)))
5710 return true;
5711
5712 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
5713 if (iter->second->HasEffect(i) && spellInfo->Effects[i].Effect && spellInfo->Effects[i].Mechanic)
5714 if (mechanicMask & (1 << spellInfo->Effects[i].Mechanic))
5715 return true;
5716 }
5717
5718 return false;
5719}
uint32 Mechanic
Definition: SpellInfo.h:321

References SpellInfo::Effects, m_appliedAuras, MAX_SPELL_EFFECTS, and SpellInfo::Mechanic.

Referenced by EarthenPowerTargetSelector::operator()(), SpellPctDamageModsDone(), and SpellTakenCritChance().

◆ HasBreakableByDamageAuraType()

bool Unit::HasBreakableByDamageAuraType ( AuraType  type,
uint32  excludeAura = 0 
) const
783{
784 AuraEffectList const& auras = GetAuraEffectsByType(type);
785 for (AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
786 if ((!excludeAura || excludeAura != (*itr)->GetSpellInfo()->Id) && //Avoid self interrupt of channeled Crowd Control spells like Seduction
787 ((*itr)->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_TAKE_DAMAGE))
788 return true;
789 return false;
790}

References AURA_INTERRUPT_FLAG_TAKE_DAMAGE, and GetAuraEffectsByType().

Referenced by HasBreakableByDamageCrowdControlAura().

◆ HasBreakableByDamageCrowdControlAura()

bool Unit::HasBreakableByDamageCrowdControlAura ( Unit excludeCasterChannel = nullptr) const
793{
794 uint32 excludeAura = 0;
795 if (Spell* currentChanneledSpell = excludeCasterChannel ? excludeCasterChannel->GetCurrentSpell(CURRENT_CHANNELED_SPELL) : nullptr)
796 excludeAura = currentChanneledSpell->GetSpellInfo()->Id; //Avoid self interrupt of channeled Crowd Control spells like Seduction
797
803}
@ SPELL_AURA_MOD_FEAR
Definition: SpellAuraDefines.h:70
@ SPELL_AURA_MOD_ROOT
Definition: SpellAuraDefines.h:89
@ SPELL_AURA_MOD_CONFUSE
Definition: SpellAuraDefines.h:68
@ SPELL_AURA_MOD_STUN
Definition: SpellAuraDefines.h:75
bool HasBreakableByDamageAuraType(AuraType type, uint32 excludeAura=0) const
Definition: Unit.cpp:782
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition: Unit.h:2061

References CURRENT_CHANNELED_SPELL, GetCurrentSpell(), HasBreakableByDamageAuraType(), SPELL_AURA_MOD_CONFUSE, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, and SPELL_AURA_TRANSFORM.

Referenced by PetAI::CanAttack(), npc_pet_gen_valkyr_guardian::OwnerAttacked(), CasterAI::UpdateAI(), npc_pet_gen_valkyr_guardian::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), and PetAI::UpdateAI().

◆ HasExtraUnitMovementFlag()

uint16 Unit::HasExtraUnitMovementFlag ( uint16  f) const
inline

◆ HasInvisibilityAura()

bool Unit::HasInvisibilityAura ( ) const
inline

◆ HasNegativeAuraWithAttribute()

bool Unit::HasNegativeAuraWithAttribute ( uint32  flag,
ObjectGuid  guid = ObjectGuid::Empty 
)
5694{
5695 for (AuraApplicationMap::const_iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter)
5696 {
5697 Aura const* aura = iter->second->GetBase();
5698 if (!iter->second->IsPositive() && aura->GetSpellInfo()->Attributes & flag && (!guid || aura->GetCasterGUID() == guid))
5699 return true;
5700 }
5701 return false;
5702}
uint32 Attributes
Definition: SpellInfo.h:322

References SpellInfo::Attributes, Aura::GetCasterGUID(), Aura::GetSpellInfo(), and m_appliedAuras.

◆ HasNegativeAuraWithInterruptFlag()

bool Unit::HasNegativeAuraWithInterruptFlag ( uint32  flag,
ObjectGuid  guid = ObjectGuid::Empty 
)
5682{
5683 if (!(m_interruptMask & flag))
5684 return false;
5685 for (AuraApplicationList::iterator iter = m_interruptableAuras.begin(); iter != m_interruptableAuras.end(); ++iter)
5686 {
5687 if (!(*iter)->IsPositive() && (*iter)->GetBase()->GetSpellInfo()->AuraInterruptFlags & flag && (!guid || (*iter)->GetBase()->GetCasterGUID() == guid))
5688 return true;
5689 }
5690 return false;
5691}

References m_interruptableAuras, and m_interruptMask.

Referenced by ThreatContainer::SelectNextVictim().

◆ HasNpcFlag()

◆ HasSharedVision()

◆ HasSpell()

◆ HasSpellCooldown()

◆ HasSpellItemCooldown()

virtual bool Unit::HasSpellItemCooldown ( uint32  ,
uint32   
) const
inlinevirtual

Reimplemented in Player.

2419{ return false; }

Referenced by Spell::CheckCast(), and ProcDamageAndSpellFor().

◆ HasStealthAura()

◆ HasUnitFlag()

bool Unit::HasUnitFlag ( UnitFlags  flags) const
inline
1480{ return HasFlag(UNIT_FIELD_FLAGS, flags); }

References Object::HasFlag(), and UNIT_FIELD_FLAGS.

Referenced by _IsValidAssistTarget(), _IsValidAttackTarget(), Player::ActivateTaxiPathTo(), Vehicle::AddPassenger(), AttackerStateUpdate(), boss_malygos::boss_malygosAI::AttackStart(), SmartAI::AttackStart(), boss_dorothee::boss_dorotheeAI::AttackStart(), npc_halazzi_lynx::npc_halazzi_lynxAI::AttackStart(), npc_ghostly_priest::npc_ghostly_priestAI::AttackStart(), npc_phantom_mage::npc_phantom_mageAI::AttackStart(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::AttackStart(), npc_spectral_footman::npc_spectral_footmanAI::AttackStart(), npc_tortured_rifleman::npc_tortured_riflemanAI::AttackStart(), violet_hold_trashAI::AttackStart(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::AttackStart(), npc_ravenous_worg::npc_ravenous_worgAI::AttackStart(), npc_swarm_scarab::npc_swarm_scarabAI::CanAIAttack(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::CanAIAttack(), Creature::CanAssistTo(), PetAI::CanAttack(), Player::CanNoReagentCast(), CanSwim(), CanUseAttackType(), Spell::CheckEffectTarget(), boss_muru::boss_muruAI::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), npc_frost_sphere::npc_frost_sphereAI::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), boss_malygos::boss_malygosAI::DamageTaken(), npc_power_spark::npc_power_sparkAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::DamageTaken(), boss_illidan_stormrage::boss_illidan_stormrageAI::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), boss_jormungarAI::DoAction(), Spell::DoSpellHitOnUnit(), RandomMovementGenerator< T >::DoUpdate(), violet_hold_trashAI::EnterCombat(), boss_sindragosa::boss_sindragosaAI::EnterEvadeMode(), SmartAI::EnterEvadeMode(), GetReactionTo(), GetVelocity(), spell_gen_model_visible::HandleEffectApply(), WorldSession::HandleMovementOpcodes(), spell_gen_mounted_charge::HandleScriptEffect(), IsImmuneToNPC(), IsImmuneToPC(), IsInCombat(), IsMounted(), IsPetInCombat(), isTargetableForAttack(), boss_novos::boss_novosAI::JustSummoned(), Condition::Meets(), MotionMaster::MoveCharge(), MotionMaster::MoveChase(), MotionMaster::MoveConfused(), MotionMaster::MoveDistract(), MotionMaster::MoveFall(), MotionMaster::MoveFleeing(), MotionMaster::MoveFollow(), boss_dorothee::boss_dorotheeAI::MoveInLineOfSight(), boss_professor_putricide::boss_professor_putricideAI::MoveInLineOfSight(), boss_palehoof::boss_palehoofAI::MoveInLineOfSight(), npc_massive_jormungar::npc_massive_jormungarAI::MoveInLineOfSight(), npc_ferocious_rhino::npc_ferocious_rhinoAI::MoveInLineOfSight(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::MoveInLineOfSight(), npc_frenzied_worgen::npc_frenzied_worgenAI::MoveInLineOfSight(), npc_nether_drake::npc_nether_drakeAI::MoveInLineOfSight(), MotionMaster::MoveLand(), MotionMaster::MovePath(), MotionMaster::MovePoint(), MotionMaster::MoveRandom(), MotionMaster::MoveSeekAssistance(), MotionMaster::MoveSeekAssistanceDistract(), MotionMaster::MoveSplinePath(), MotionMaster::MoveTakeoff(), MotionMaster::MoveTargetedHome(), npc_toc_druid::npc_toc_druidAI::myCanCast(), npc_toc_shaman::npc_toc_shamanAI::myCanCast(), npc_toc_paladin::npc_toc_paladinAI::myCanCast(), npc_toc_priest::npc_toc_priestAI::myCanCast(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::myCanCast(), npc_toc_warlock::npc_toc_warlockAI::myCanCast(), npc_toc_mage::npc_toc_mageAI::myCanCast(), npc_toc_boomkin::npc_toc_boomkinAI::myCanCast(), npc_toc_pet_warlock::npc_toc_pet_warlockAI::myCanCast(), Acore::AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck::operator()(), Creature::reachWithSpellAttack(), Creature::reachWithSpellCure(), Creature::RefreshSwimmingFlag(), ScriptedAI::SelectSpell(), Player::SetClientControl(), SetSpeed(), Player::Update(), npc_onyxian_lair_guard::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_toc_warrior::npc_toc_warriorAI::UpdateAI(), npc_toc_dk::npc_toc_dkAI::UpdateAI(), npc_toc_rogue::npc_toc_rogueAI::UpdateAI(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::UpdateAI(), npc_toc_retro_paladin::npc_toc_retro_paladinAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), npc_power_spark::npc_power_sparkAI::UpdateAI(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::UpdateAI(), npc_xt002_heart::npc_xt002_heartAI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::UpdateAI(), npc_ravenous_worg::npc_ravenous_worgAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_ahune::boss_ahuneAI::UpdateAI(), and Player::UpdateTriggerVisibility().

◆ HasUnitFlag2()

◆ HasUnitMovementFlag()

◆ HasUnitState()

bool Unit::HasUnitState ( const uint32  f) const
inline
1398{ return (m_state & f); }

References m_state.

Referenced by Spell::_cast(), Creature::_IsTargetAcceptable(), _IsValidAssistTarget(), _IsValidAttackTarget(), Player::ActivateTaxiPathTo(), AddThreat(), Attack(), AttackerStateUpdate(), FollowerAI::AttackStart(), npc_raging_spirit::npc_raging_spiritAI::AttackStart(), boss_apothecary_hummel::boss_apothecary_hummelAI::boss_apothecary_hummelAI(), boss_azuregos::boss_azuregosAI::boss_azuregosAI(), boss_jarien::boss_jarien(), boss_mor_grayhoof::boss_mor_grayhoof(), boss_ouro::boss_ouro(), boss_sothos::boss_sothos(), boss_twinemperorsAI::boss_twinemperorsAI(), PathGenerator::CalculatePath(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::CanAIAttack(), PetAI::CanAttack(), Player::CanEquipItem(), CanFreeMove(), Creature::CanPeriodicallyCallForAssistance(), Creature::CanStartAttack(), spell_dk_death_grip::CheckCast(), Spell::CheckCast(), boss_kelidan_the_breaker::boss_kelidan_the_breakerAI::CheckChannelers(), Spell::CheckPetCast(), spell_warr_retaliation::CheckProc(), CreatureUnitRelocationWorker(), boss_garfrost::boss_garfrostAI::DamageTaken(), boss_viscidus::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), DealDamage(), DealMeleeDamage(), DisableRotate(), UnitAI::DoCast(), UnitAI::DoCastAOE(), UnitAI::DoMeleeAttackIfReady(), boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), UnitAI::DoSpellAttackIfReady(), UnitAI::DoSpellAttackToRandomTargetIfReady(), Spell::DoSpellHitOnUnit(), WaypointMovementGenerator< Creature >::DoUpdate(), RandomMovementGenerator< T >::DoUpdate(), Spell::EffectDistract(), Spell::EffectKnockBack(), CritterAI::EnterCombat(), npc_coren_direbrew_sisters::EnterCombat(), CritterAI::EnterEvadeMode(), SmartAI::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), Spell::finish(), Player::GetInitialVisiblePackets(), WorldSession::HandleAuctionListItems(), spell_dru_starfall_dummy::HandleDummy(), WorldSession::HandleEmoteOpcode(), WorldSession::HandleInitiateTradeOpcode(), WorldSession::HandleMoveTeleportAck(), AuraEffect::HandleObsModPowerAuraTick(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), WorldSession::HandlePetCastSpellOpcode(), WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandlePlayerLoginToCharInWorld(), AuraEffect::HandleProcTriggerDamageAuraProc(), ArenaSpectator::HandleSpectatorSpectateCommand(), isAttackingPlayer(), boss_faction_championsAI::IsCCed(), Creature::IsInEvadeMode(), IsInFlight(), IsMovementPreventedByCasting(), Creature::IsMovementPreventedByCasting(), isPossessed(), isPossessedByPlayer(), isSpellBlocked(), IsStopped(), isTargetableForAttack(), IsValidCombatTarget(), PetAI::KilledUnit(), CreatureGroup::LeaderMoveTo(), MagicSpellHitResult(), MeleeSpellHitResult(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), npc_toc_druid::npc_toc_druidAI::myCanCast(), npc_toc_shaman::npc_toc_shamanAI::myCanCast(), npc_toc_paladin::npc_toc_paladinAI::myCanCast(), npc_toc_priest::npc_toc_priestAI::myCanCast(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::myCanCast(), npc_toc_warlock::npc_toc_warlockAI::myCanCast(), npc_toc_mage::npc_toc_mageAI::myCanCast(), npc_toc_hunter::npc_toc_hunterAI::myCanCast(), npc_toc_boomkin::npc_toc_boomkinAI::myCanCast(), npc_toc_warrior::npc_toc_warriorAI::myCanCast(), npc_toc_dk::npc_toc_dkAI::myCanCast(), npc_toc_rogue::npc_toc_rogueAI::myCanCast(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::myCanCast(), npc_toc_retro_paladin::npc_toc_retro_paladinAI::myCanCast(), boss_twin_valkyrAI::myDoMeleeAttackIfReady(), npc_apothecary_baxter::npc_apothecary_baxter(), npc_batrider::npc_batrider(), Acore::FriendlyCCedInRange::operator()(), SmartScript::ProcessAction(), RemoveCharmedBy(), boss_kormok::Reset(), boss_baroness_anastari::boss_baroness_anastariAI::Reset(), npc_ohgan::npc_ohganAI::Reset(), boss_thekal::boss_thekalAI::Reset(), npc_zealot_lorkhan::npc_zealot_lorkhanAI::Reset(), npc_zealot_zath::npc_zealot_zathAI::Reset(), boss_isalien::Reset(), npc_anubisath_guardian::Reset(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::Reset(), RollMeleeOutcomeAgainst(), boss_faction_championsAI::SelectEnemyCaster(), Player::SetClientControl(), SetContestedPvP(), SetControlled(), Creature::SetDisableGravity(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), Creature::SetHover(), SetInCombatState(), SetInFront(), SetRooted(), SetStunned(), WaypointMovementGenerator< Creature >::StartMove(), lfg::LFGMgr::TeleportPlayer(), CreatureAI::TriggerAlert(), Player::Update(), Update(), TimedFleeingMovementGenerator::Update(), npc_razzashi_cobra_venoxis::npc_razzashi_cobra_venoxis_AI::UpdateAI(), boss_sartharion_dragonAI::UpdateAI(), CombatAI::UpdateAI(), CasterAI::UpdateAI(), BossAI::UpdateAI(), WorldBossAI::UpdateAI(), npc_av_marshal_or_warmaster::npc_av_marshal_or_warmasterAI::UpdateAI(), ironhand_guardian::ironhand_guardianAI::UpdateAI(), boss_anubshiah::boss_anubshiahAI::UpdateAI(), boss_emperor_dagran_thaurissan::boss_draganthaurissanAI::UpdateAI(), boss_eviscerator::boss_evisceratorAI::UpdateAI(), boss_gorosh_the_dervish::boss_gorosh_the_dervishAI::UpdateAI(), boss_grizzle::boss_grizzleAI::UpdateAI(), boss_hedrum::boss_hedrumAI::UpdateAI(), boss_moira_bronzebeardAI::UpdateAI(), boss_high_priestess_thaurissanAI::UpdateAI(), boss_okthor::boss_okthorAI::UpdateAI(), boss_drakkisath::boss_drakkisathAI::UpdateAI(), boss_halycon::boss_halyconAI::UpdateAI(), boss_highlord_omokk::boss_highlordomokkAI::UpdateAI(), boss_lord_valthalak::boss_lord_valthalakAI::UpdateAI(), boss_overlord_wyrmthalak::boss_overlordwyrmthalakAI::UpdateAI(), boss_quartermaster_zigris::UpdateAI(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI(), boss_solakar_flamewreath::boss_solakar_flamewreathAI::UpdateAI(), boss_the_beast::boss_thebeastAI::UpdateAI(), boss_urok_doomhowl::boss_urok_doomhowlAI::UpdateAI(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_chromaggus::boss_chromaggusAI::UpdateAI(), boss_ebonroc::boss_ebonrocAI::UpdateAI(), boss_firemaw::boss_firemawAI::UpdateAI(), boss_flamegor::boss_flamegorAI::UpdateAI(), boss_victor_nefarius::boss_victor_nefariusAI::UpdateAI(), boss_nefarian::UpdateAI(), boss_razorgore::boss_razorgoreAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_garr::boss_garrAI::UpdateAI(), boss_golemagg::boss_golemaggAI::UpdateAI(), npc_core_rager::npc_core_ragerAI::UpdateAI(), boss_majordomo::boss_majordomoAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), npc_flamewaker_priest::npc_flamewaker_priestAI::UpdateAI(), npc_mc_core_hound::npc_mc_core_houndAI::UpdateAI(), boss_curator::boss_curatorAI::UpdateAI(), boss_maiden_of_virtue::UpdateAI(), boss_midnight::boss_midnightAI::UpdateAI(), boss_attumen::boss_attumenAI::UpdateAI(), boss_attumen_midnight::boss_attumen_midnightAI::UpdateAI(), boss_moroes::UpdateAI(), boss_servant_quarters::UpdateAI(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::UpdateAI(), boss_priestess_delrissa::boss_priestess_delrissaAI::UpdateAI(), boss_priestess_lackey_commonAI::UpdateAI(), boss_kagani_nightstrike::boss_kagani_nightstrikeAI::UpdateAI(), boss_selin_fireheart::boss_selin_fireheartAI::UpdateAI(), boss_vexallus::boss_vexallusAI::UpdateAI(), npc_mograine::npc_mograineAI::UpdateAI(), boss_high_inquisitor_whitemane::boss_high_inquisitor_whitemaneAI::UpdateAI(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), boss_brutallus::boss_brutallusAI::UpdateAI(), boss_sacrolash::boss_sacrolashAI::UpdateAI(), boss_alythess::boss_alythessAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), boss_kalec::boss_kalecAI::UpdateAI(), boss_sathrovarr::boss_sathrovarrAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), boss_muru::boss_muruAI::UpdateAI(), boss_entropius::boss_entropiusAI::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_jaina_proudmoore_bfu::npc_jaina_proudmoore_bfuAI::UpdateAI(), boss_blight_worm::boss_blight_wormAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_gahzranka::boss_gahzrankaAI::UpdateAI(), boss_grilek::boss_grilekAI::UpdateAI(), boss_hakkar::boss_hakkarAI::UpdateAI(), boss_hazzarah::UpdateAI(), boss_jeklik::UpdateAI(), boss_jindo::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), boss_marli::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), boss_venoxis::boss_venoxisAI::UpdateAI(), boss_wushoolay::boss_wushoolayAI::UpdateAI(), npc_coren_direbrew::UpdateAI(), npc_hallows_end_soh::UpdateAI(), boss_headless_horseman::UpdateAI(), boss_archimonde::boss_archimondeAI::UpdateAI(), boss_epoch::boss_epochAI::UpdateAI(), boss_infinite_corruptor::boss_infinite_corruptorAI::UpdateAI(), boss_mal_ganis::boss_mal_ganisAI::UpdateAI(), boss_meathook::boss_meathookAI::UpdateAI(), boss_salramm::boss_salrammAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), boss_captain_skarloc::boss_captain_skarlocAI::UpdateAI(), boss_epoch_hunter::boss_epoch_hunterAI::UpdateAI(), boss_lieutenant_drake::boss_lieutenant_drakeAI::UpdateAI(), boss_aeonus::boss_aeonusAI::UpdateAI(), boss_chrono_lord_deja::boss_chrono_lord_dejaAI::UpdateAI(), boss_temporus::boss_temporusAI::UpdateAI(), npc_time_rift::npc_time_riftAI::UpdateAI(), boss_onyxia::UpdateAI(), npc_onyxian_lair_guard::UpdateAI(), npc_belnistrasz::npc_belnistraszAI::UpdateAI(), boss_kurinnaxx::UpdateAI(), npc_shadowpriest_sezziz::npc_shadowpriest_sezzizAI::UpdateAI(), boss_elder_nadox::UpdateAI(), boss_volazj::UpdateAI(), boss_jedoga_shadowseeker::UpdateAI(), boss_taldaram::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), boss_hadronox::boss_hadronoxAI::UpdateAI(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::UpdateAI(), boss_krik_thir::boss_krik_thirAI::UpdateAI(), boss_sartharion::boss_sartharionAI::UpdateAI(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::UpdateAI(), npc_baltharus_the_warborn_clone::npc_baltharus_the_warborn_cloneAI::UpdateAI(), boss_general_zarithrian::boss_general_zarithrianAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_twilight_halion::boss_twilight_halionAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_eadric::boss_eadricAI::UpdateAI(), boss_paletress::boss_paletressAI::UpdateAI(), npc_memory::npc_memoryAI::UpdateAI(), npc_argent_soldier::npc_argent_soldierAI::UpdateAI(), boss_black_knight::boss_black_knightAI::UpdateAI(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::UpdateAI(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_anubarak_spike::npc_anubarak_spikeAI::UpdateAI(), npc_toc_hunter::npc_toc_hunterAI::UpdateAI(), boss_jaraxxus::boss_jaraxxusAI::UpdateAI(), npc_fel_infernal::npc_fel_infernalAI::UpdateAI(), npc_mistress_of_pain::npc_mistress_of_painAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_twin_valkyrAI::UpdateAI(), boss_dred::boss_dredAI::UpdateAI(), boss_novos::boss_novosAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), boss_trollgore::boss_trollgoreAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), npc_fos_corrupted_soul_fragment::npc_fos_corrupted_soul_fragmentAI::UpdateAI(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), boss_falric::boss_falricAI::UpdateAI(), boss_marwyn::boss_marwynAI::UpdateAI(), npc_ghostly_priest::npc_ghostly_priestAI::UpdateAI(), npc_phantom_mage::npc_phantom_mageAI::UpdateAI(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::UpdateAI(), npc_spectral_footman::npc_spectral_footmanAI::UpdateAI(), npc_tortured_rifleman::npc_tortured_riflemanAI::UpdateAI(), boss_frostsworn_general::boss_frostsworn_generalAI::UpdateAI(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::UpdateAI(), npc_hor_risen_witch_doctor::npc_hor_risen_witch_doctorAI::UpdateAI(), npc_hor_lumbering_abomination::npc_hor_lumbering_abominationAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::UpdateAI(), boss_drakkari_elemental::boss_drakkari_elementalAI::UpdateAI(), npc_living_mojo::npc_living_mojoAI::UpdateAI(), boss_eck::boss_eckAI::UpdateAI(), boss_gal_darah::boss_gal_darahAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_slad_ran::boss_slad_ranAI::UpdateAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::UpdateAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::UpdateAI(), boss_festergut::boss_festergutAI::UpdateAI(), npc_stinky_icc::npc_stinky_iccAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), npc_gunship_boarding_add::npc_gunship_boarding_add_realAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_darnavan::npc_darnavanAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), npc_precious_icc::npc_precious_iccAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_spinestalker::npc_spinestalkerAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::UpdateAI(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::UpdateAI(), npc_risen_archmage::npc_risen_archmageAI::UpdateAI(), npc_blazing_skeleton::npc_blazing_skeletonAI::UpdateAI(), npc_gluttonous_abomination::npc_gluttonous_abominationAI::UpdateAI(), npc_rotting_frost_giant::npc_rotting_frost_giantAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), boss_sister_svalna::boss_sister_svalnaAI::UpdateAI(), npc_captain_arnath::npc_captain_arnathAI::UpdateAI(), npc_captain_brandon::npc_captain_brandonAI::UpdateAI(), npc_captain_grondel::npc_captain_grondelAI::UpdateAI(), npc_captain_rupert::npc_captain_rupertAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), npc_icc_skybreaker_hierophant::npc_icc_skybreaker_hierophantAI::UpdateAI(), npc_icc_skybreaker_marksman::npc_icc_skybreaker_marksmanAI::UpdateAI(), npc_icc_skybreaker_vicar::npc_icc_skybreaker_vicarAI::UpdateAI(), npc_icc_skybreaker_luminary::npc_icc_skybreaker_luminaryAI::UpdateAI(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::UpdateAI(), npc_icc_severed_essence::npc_icc_severed_essenceAI::UpdateAI(), npc_icc_spire_frostwyrm::npc_icc_spire_frostwyrmAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::UpdateAI(), boss_isle_of_conquest::boss_isle_of_conquestAI::UpdateAI(), boss_anubrekhan::boss_anubrekhanAI::UpdateAI(), boss_faerlina::boss_faerlinaAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_grobbulus::boss_grobbulusAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::UpdateAI(), boss_loatheb::boss_loathebAI::UpdateAI(), boss_maexxna::boss_maexxnaAI::UpdateAI(), boss_noth::boss_nothAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_razuvious::boss_razuviousAI::UpdateAI(), boss_razuvious_minion::boss_razuvious_minionAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_nexus_lord::npc_nexus_lordAI::UpdateAI(), npc_scion_of_eternity::npc_scion_of_eternityAI::UpdateAI(), boss_anomalus::boss_anomalusAI::UpdateAI(), boss_commander_stoutbeard::boss_commander_stoutbeardAI::UpdateAI(), boss_keristrasza::boss_keristraszaAI::UpdateAI(), boss_magus_telestra::boss_magus_telestraAI::UpdateAI(), boss_ormorok::boss_ormorokAI::UpdateAI(), boss_drakos::boss_drakosAI::UpdateAI(), boss_eregos::boss_eregosAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), npc_stormforged_lieutenant::npc_stormforged_lieutenantAI::UpdateAI(), boss_ionar::boss_ionarAI::UpdateAI(), boss_loken::boss_lokenAI::UpdateAI(), boss_volkhan::boss_volkhanAI::UpdateAI(), npc_molten_golem::npc_molten_golemAI::UpdateAI(), npc_hol_monument::npc_hol_monumentAI::UpdateAI(), boss_krystallus::boss_krystallusAI::UpdateAI(), boss_maiden_of_grief::boss_maiden_of_griefAI::UpdateAI(), boss_sjonnir::boss_sjonnirAI::UpdateAI(), boss_sjonnir_iron_sludge::boss_sjonnir_iron_sludgeAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_steelbreaker::boss_steelbreakerAI::UpdateAI(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_auriaya::boss_auriayaAI::UpdateAI(), boss_flame_leviathan::boss_flame_leviathanAI::UpdateAI(), boss_freya::boss_freyaAI::UpdateAI(), boss_freya_elder_stonebark::boss_freya_elder_stonebarkAI::UpdateAI(), boss_freya_elder_brightleaf::boss_freya_elder_brightleafAI::UpdateAI(), boss_freya_elder_ironbranch::boss_freya_elder_ironbranchAI::UpdateAI(), boss_freya_summons::boss_freya_summonsAI::UpdateAI(), boss_vezax::boss_vezaxAI::UpdateAI(), boss_hodir::boss_hodirAI::UpdateAI(), npc_ulduar_hodir_priest::npc_ulduar_hodir_priestAI::UpdateAI(), npc_ulduar_hodir_druid::npc_ulduar_hodir_druidAI::UpdateAI(), npc_ulduar_hodir_shaman::npc_ulduar_hodir_shamanAI::UpdateAI(), npc_ulduar_hodir_mage::npc_ulduar_hodir_mageAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), boss_kologarn::boss_kologarnAI::UpdateAI(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::UpdateAI(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_thorim::boss_thorimAI::UpdateAI(), boss_thorim_sif::boss_thorim_sifAI::UpdateAI(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::UpdateAI(), boss_thorim_gauntlet_npcs::boss_thorim_gauntlet_npcsAI::UpdateAI(), boss_thorim_runic_colossus::boss_thorim_runic_colossusAI::UpdateAI(), boss_thorim_ancient_rune_giant::boss_thorim_ancient_rune_giantAI::UpdateAI(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::UpdateAI(), boss_yoggsaron::boss_yoggsaronAI::UpdateAI(), boss_yoggsaron_constrictor_tentacle::boss_yoggsaron_constrictor_tentacleAI::UpdateAI(), boss_yoggsaron_keeper::boss_yoggsaron_keeperAI::UpdateAI(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::UpdateAI(), npc_ulduar_storm_tempered_keeper::npc_ulduar_storm_tempered_keeperAI::UpdateAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), boss_keleseth::boss_kelesethAI::UpdateAI(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::UpdateAI(), boss_skarvald_the_constructor::boss_skarvald_the_constructorAI::UpdateAI(), boss_dalronn_the_controller::boss_dalronn_the_controllerAI::UpdateAI(), npc_enslaved_proto_drake::npc_enslaved_proto_drakeAI::UpdateAI(), npc_massive_jormungar::npc_massive_jormungarAI::UpdateAI(), npc_ferocious_rhino::npc_ferocious_rhinoAI::UpdateAI(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::UpdateAI(), npc_frenzied_worgen::npc_frenzied_worgenAI::UpdateAI(), boss_skadi::boss_skadiAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_archavon::boss_archavonAI::UpdateAI(), boss_emalon::boss_emalonAI::UpdateAI(), boss_koralon::boss_koralonAI::UpdateAI(), boss_toravon::boss_toravonAI::UpdateAI(), boss_cyanigosa::boss_cyanigosaAI::UpdateAI(), boss_erekem::boss_erekemAI::UpdateAI(), npc_erekem_guard::npc_erekem_guardAI::UpdateAI(), boss_lavanthor::boss_lavanthorAI::UpdateAI(), boss_moragg::boss_moraggAI::UpdateAI(), boss_xevozz::boss_xevozzAI::UpdateAI(), boss_zuramat::boss_zuramatAI::UpdateAI(), npc_dalaran_mage::npc_dalaran_mageAI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::UpdateAI(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::UpdateAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::UpdateAI(), boss_exarch_maladaar::boss_exarch_maladaarAI::UpdateAI(), boss_nexusprince_shaffar::boss_nexusprince_shaffarAI::UpdateAI(), boss_pandemonius::boss_pandemoniusAI::UpdateAI(), boss_talon_king_ikiss::boss_talon_king_ikissAI::UpdateAI(), boss_anzu::boss_anzuAI::UpdateAI(), boss_murmur::boss_murmurAI::UpdateAI(), boss_gurtogg_bloodboil::boss_gurtogg_bloodboilAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_mother_shahraz::boss_shahrazAI::UpdateAI(), boss_essence_of_suffering::boss_essence_of_sufferingAI::UpdateAI(), boss_essence_of_desire::boss_essence_of_desireAI::UpdateAI(), boss_essence_of_anger::boss_essence_of_angerAI::UpdateAI(), boss_shade_of_akama::boss_shade_of_akamaAI::UpdateAI(), npc_akama_shade::npc_akamaAI::UpdateAI(), boss_supremus::boss_supremusAI::UpdateAI(), boss_teron_gorefiend::boss_teron_gorefiendAI::UpdateAI(), boss_najentus::boss_najentusAI::UpdateAI(), boss_gathios_the_shatterer::boss_gathios_the_shattererAI::UpdateAI(), boss_high_nethermancer_zerevor::boss_high_nethermancer_zerevorAI::UpdateAI(), boss_lady_malande::boss_lady_malandeAI::UpdateAI(), boss_veras_darkshadow::boss_veras_darkshadowAI::UpdateAI(), boss_doomlord_kazzak::boss_doomlordkazzakAI::UpdateAI(), boss_doomwalker::boss_doomwalkerAI::UpdateAI(), boss_fathomlord_karathress::boss_fathomlord_karathressAI::UpdateAI(), boss_hydross_the_unstable::boss_hydross_the_unstableAI::UpdateAI(), boss_lady_vashj::boss_lady_vashjAI::UpdateAI(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::UpdateAI(), npc_inner_demon::npc_inner_demonAI::UpdateAI(), boss_the_lurker_below::boss_the_lurker_belowAI::UpdateAI(), boss_morogrim_tidewalker::boss_morogrim_tidewalkerAI::UpdateAI(), boss_ahune::boss_ahuneAI::UpdateAI(), npc_steamrigger_mechanic::npc_steamrigger_mechanicAI::UpdateAI(), boss_ghazan::UpdateAI(), boss_the_black_stalker::UpdateAI(), boss_gruul::boss_gruulAI::UpdateAI(), boss_high_king_maulgar::boss_high_king_maulgarAI::UpdateAI(), boss_olm_the_summoner::boss_olm_the_summonerAI::UpdateAI(), boss_kiggler_the_crazed::boss_kiggler_the_crazedAI::UpdateAI(), boss_blindeye_the_seer::boss_blindeye_the_seerAI::UpdateAI(), boss_krosh_firehand::boss_krosh_firehandAI::UpdateAI(), boss_broggok::boss_broggokAI::UpdateAI(), boss_kelidan_the_breaker::boss_kelidan_the_breakerAI::UpdateAI(), npc_shadowmoon_channeler::npc_shadowmoon_channelerAI::UpdateAI(), boss_the_maker::boss_the_makerAI::UpdateAI(), boss_omor_the_unscarred::boss_omor_the_unscarredAI::UpdateAI(), boss_nazan::boss_nazanAI::UpdateAI(), boss_watchkeeper_gargolmar::boss_watchkeeper_gargolmarAI::UpdateAI(), boss_magtheridon::boss_magtheridonAI::UpdateAI(), boss_warbringer_omrogg::boss_warbringer_omroggAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), boss_dalliah_the_doomsayer::boss_dalliah_the_doomsayerAI::UpdateAI(), boss_harbinger_skyriss::boss_harbinger_skyrissAI::UpdateAI(), boss_wrath_scryer_soccothrates::boss_wrath_scryer_soccothratesAI::UpdateAI(), boss_zereketh_the_unbound::boss_zereketh_the_unboundAI::UpdateAI(), boss_commander_sarannis::boss_commander_sarannisAI::UpdateAI(), boss_high_botanist_freywinn::boss_high_botanist_freywinnAI::UpdateAI(), boss_laj::boss_lajAI::UpdateAI(), boss_thorngrin_the_tender::boss_thorngrin_the_tenderAI::UpdateAI(), boss_warp_splinter::boss_warp_splinterAI::UpdateAI(), boss_alar::boss_alarAI::UpdateAI(), boss_high_astromancer_solarian::boss_high_astromancer_solarianAI::UpdateAI(), boss_kaelthas::boss_kaelthasAI::UpdateAI(), boss_void_reaver::boss_void_reaverAI::UpdateAI(), boss_gatewatcher_gyrokill::boss_gatewatcher_gyrokillAI::UpdateAI(), boss_gatewatcher_iron_hand::boss_gatewatcher_iron_handAI::UpdateAI(), boss_mechano_lord_capacitus::boss_mechano_lord_capacitusAI::UpdateAI(), boss_nethermancer_sepethrea::boss_nethermancer_sepethreaAI::UpdateAI(), boss_pathaleon_the_calculator::boss_pathaleon_the_calculatorAI::UpdateAI(), npc_maghar_captive::npc_maghar_captiveAI::UpdateAI(), adyen_the_lightbringer::adyen_the_lightbringerAI::UpdateAI(), anchorite_karja::anchorite_karjaAI::UpdateAI(), exarch_orelis::exarch_orelisAI::UpdateAI(), socrethar::socretharAI::UpdateAI(), kaylaan_the_lost::kaylaan_the_lostAI::UpdateAI(), npc_phase_hunter::npc_phase_hunterAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_ishanah::ishanahAI::UpdateAI(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::UpdateAI(), npc_pet_gen_target_following_bomb::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), emerald_dragonAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_target_dummy::npc_target_dummyAI::UpdateAI(), PetAI::UpdateAI(), npc_orb_carrier::npc_orb_carrierAI::UpdateAI(), npc_hor_raging_ghoul::npc_hor_raging_ghoulAI::UpdateAI(), npc_gunship_rocketeer::npc_gunship_rocketeerAI::UpdateAI(), npc_suppresser::npc_suppresserAI::UpdateAI(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::UpdateAI(), boss_yoggsaron_corruptor_tentacle::boss_yoggsaron_corruptor_tentacleAI::UpdateAI(), npc_wg_spirit_guide::npc_wg_spirit_guideAI::UpdateAI(), Player::UpdateCharmedAI(), npc_general_andorov::UpdateEscortAI(), npc_onyx_flamecaller::npc_onyx_flamecallerAI::UpdateEscortAI(), boss_bjarngrim::boss_bjarngrimAI::UpdateEscortAI(), npc_kurenai_captive::npc_kurenai_captiveAI::UpdateEscortAI(), npc_isla_starmane::npc_isla_starmaneAI::UpdateEscortAI(), SmartAI::UpdatePath(), and SmartScript::UpdateTimer().

◆ HasUnitTypeMask()

◆ HasVisibleAuraType()

bool Unit::HasVisibleAuraType ( AuraType  auraType) const
5632{
5633 AuraEffectList const& mAuraList = GetAuraEffectsByType(auraType);
5634 for (AuraEffectList::const_iterator i = mAuraList.begin(); i != mAuraList.end(); ++i)
5635 if( (*i)->GetBase()->CanBeSentToClient() )
5636 return true;
5637
5638 return false;
5639}

References GetAuraEffectsByType().

◆ haveOffhandWeapon()

◆ HealBySpell()

int32 Unit::HealBySpell ( HealInfo healInfo,
bool  critical = false 
)
11203{
11204 uint32 heal = healInfo.GetHeal();
11205 sScriptMgr->ModifyHealReceived(this, healInfo.GetTarget(), heal, healInfo.GetSpellInfo());
11206 healInfo.SetHeal(heal);
11207
11208 // calculate heal absorb and reduce healing
11209 CalcHealAbsorb(healInfo);
11210
11211 int32 gain = Unit::DealHeal(healInfo.GetHealer(), healInfo.GetTarget(), healInfo.GetHeal());
11212 SendHealSpellLog(healInfo.GetTarget(), healInfo.GetSpellInfo()->Id, healInfo.GetHeal(), uint32(healInfo.GetHeal() - gain), healInfo.GetAbsorb(), critical);
11213 return gain;
11214}
Unit * GetHealer() const
Definition: Unit.h:830
uint32 GetAbsorb() const
Definition: Unit.h:833
void SetHeal(uint32 amount)
Definition: Unit.h:825
static void CalcHealAbsorb(HealInfo &healInfo)
Definition: Unit.cpp:2464
static int32 DealHeal(Unit *healer, Unit *victim, uint32 addhealth)
Definition: Unit.cpp:10911
void SendHealSpellLog(Unit *victim, uint32 SpellID, uint32 Damage, uint32 OverHeal, uint32 Absorb, bool critical=false)
Definition: Unit.cpp:11187

References CalcHealAbsorb(), DealHeal(), HealInfo::GetAbsorb(), HealInfo::GetHeal(), HealInfo::GetHealer(), HealInfo::GetSpellInfo(), HealInfo::GetTarget(), SpellInfo::Id, SendHealSpellLog(), HealInfo::SetHeal(), and sScriptMgr.

Referenced by Spell::DoAllEffectOnTarget(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), and AuraEffect::HandlePeriodicTriggerSpellAuraTick().

◆ HealthAbovePct()

◆ HealthAbovePctHealed()

bool Unit::HealthAbovePctHealed ( int32  pct,
uint32  heal 
) const
inline

◆ HealthBelowPct()

bool Unit::HealthBelowPct ( int32  pct) const
inline
1444{ return GetHealth() < CountPctFromMaxHealth(pct); }

References CountPctFromMaxHealth(), and GetHealth().

Referenced by boss_moira_bronzebeardAI::CastOnEmperorIfPossible(), boss_mor_grayhoof::DamageTaken(), boss_isalien::DamageTaken(), boss_viscidus::DamageTaken(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::DamageTaken(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::DamageTaken(), HandleDummyAuraProc(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicDummyAuraTick(), HandleProcTriggerSpell(), ScriptedAI::HealthBelowPct(), Player::LoadFromDB(), npc_death_knight_initiate::OnGossipHello(), SetHealth(), SpellPctHealingModsDone(), Update(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_curator::boss_curatorAI::UpdateAI(), boss_midnight::boss_midnightAI::UpdateAI(), boss_attumen::boss_attumenAI::UpdateAI(), boss_moroes::UpdateAI(), boss_priestess_lackey_commonAI::UpdateAI(), npc_death_knight_initiate::npc_death_knight_initiateAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), boss_kalec::boss_kalecAI::UpdateAI(), boss_sathrovarr::boss_sathrovarrAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), npc_sentinel_leader::UpdateAI(), npc_sentinel_infiltrator::UpdateAI(), boss_archimonde::boss_archimondeAI::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::UpdateAI(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_twilight_halion::boss_twilight_halionAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), boss_drakkari_elemental::boss_drakkari_elementalAI::UpdateAI(), boss_eck::boss_eckAI::UpdateAI(), boss_slad_ran::boss_slad_ranAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_anomalus::boss_anomalusAI::UpdateAI(), boss_keristrasza::boss_keristraszaAI::UpdateAI(), boss_magus_telestra::boss_magus_telestraAI::UpdateAI(), boss_ormorok::boss_ormorokAI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), boss_talon_king_ikiss::boss_talon_king_ikissAI::UpdateAI(), boss_anzu::boss_anzuAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_fathomlord_karathress::boss_fathomlord_karathressAI::UpdateAI(), boss_lady_vashj::boss_lady_vashjAI::UpdateAI(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::UpdateAI(), boss_mekgineer_steamrigger::boss_mekgineer_steamriggerAI::UpdateAI(), boss_high_king_maulgar::boss_high_king_maulgarAI::UpdateAI(), boss_omor_the_unscarred::boss_omor_the_unscarredAI::UpdateAI(), boss_watchkeeper_gargolmar::boss_watchkeeper_gargolmarAI::UpdateAI(), boss_magtheridon::boss_magtheridonAI::UpdateAI(), boss_grand_warlock_nethekurse::boss_grand_warlock_nethekurseAI::UpdateAI(), boss_commander_sarannis::boss_commander_sarannisAI::UpdateAI(), boss_thorngrin_the_tender::boss_thorngrin_the_tenderAI::UpdateAI(), boss_high_astromancer_solarian::boss_high_astromancer_solarianAI::UpdateAI(), boss_kaelthas::boss_kaelthasAI::UpdateAI(), boss_pathaleon_the_calculator::boss_pathaleon_the_calculatorAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateEscortAI(), and npc_akama_illidan::npc_akama_illidanAI::UpdateEscortAI().

◆ HealthBelowPctDamaged()

bool Unit::HealthBelowPctDamaged ( int32  pct,
uint32  damage 
) const
inline
1445{ return int64(GetHealth()) - int64(damage) < int64(CountPctFromMaxHealth(pct)); }
std::int64_t int64
Definition: Define.h:103

References CountPctFromMaxHealth(), and GetHealth().

Referenced by boss_mandokir::boss_mandokirAI::DamageDealt(), boss_gyth::boss_gythAI::DamageTaken(), boss_lord_valthalak::boss_lord_valthalakAI::DamageTaken(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::DamageTaken(), boss_quartermaster_zigris::DamageTaken(), boss_warmaster_voone::boss_warmastervooneAI::DamageTaken(), boss_nefarian::DamageTaken(), boss_baron_geddon::boss_baron_geddonAI::DamageTaken(), boss_golemagg::boss_golemaggAI::DamageTaken(), npc_core_rager::npc_core_ragerAI::DamageTaken(), boss_kormok::DamageTaken(), boss_thekal::boss_thekalAI::DamageTaken(), npc_coren_direbrew::DamageTaken(), boss_headless_horseman_head::DamageTaken(), boss_onyxia::DamageTaken(), boss_ayamiss::DamageTaken(), npc_anubisath_guardian::DamageTaken(), boss_ouro::DamageTaken(), npc_anubisath_sentinel::aqsentinelAI::DamageTaken(), npc_anubisath_defender::DamageTaken(), boss_elder_nadox::DamageTaken(), boss_volazj::DamageTaken(), boss_jedoga_shadowseeker::DamageTaken(), boss_sartharion::boss_sartharionAI::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), npc_gunship::npc_gunshipAI::DamageTaken(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DamageTaken(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DamageTaken(), npc_gunship_boarding_addAI::DamageTaken(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::DamageTaken(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::DamageTaken(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::DamageTaken(), boss_malygos::boss_malygosAI::DamageTaken(), boss_algalon_the_observer::boss_algalon_the_observerAI::DamageTaken(), npc_xt002_boombot::npc_xt002_boombotAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), boss_ghazan::DamageTaken(), boss_hungarfen::DamageTaken(), boss_vazruden::boss_vazrudenAI::DamageTaken(), boss_ysondre::boss_ysondreAI::DamageTaken(), boss_lethon::boss_lethonAI::DamageTaken(), boss_emeriss::boss_emerissAI::DamageTaken(), boss_taerar::boss_taerarAI::DamageTaken(), boss_buru::DamageTaken(), npc_salsalabim::npc_salsalabimAI::DamageTaken(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DamageTaken(), npc_bartleby::npc_bartlebyAI::DamageTaken(), npc_calvin_montague::npc_calvin_montagueAI::DamageTaken(), boss_bug_trio::DamageTaken(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::DamageTaken(), and HandleProcTriggerSpell().

◆ IncrDiminishing()

void Unit::IncrDiminishing ( DiminishingGroup  group)
14921{
14922 // Checking for existing in the table
14923 for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i)
14924 {
14925 if (i->DRGroup != group)
14926 continue;
14927 if (int32(i->hitCount) < GetDiminishingReturnsMaxLevel(group))
14928 i->hitCount += 1;
14929 return;
14930 }
14932}
DiminishingLevels GetDiminishingReturnsMaxLevel(DiminishingGroup group)
Definition: SpellMgr.cpp:265
Definition: Unit.h:703

References DIMINISHING_LEVEL_2, GetDiminishingReturnsMaxLevel(), GameTime::GetGameTimeMS(), and m_Diminishing.

Referenced by Spell::DoSpellHitOnUnit().

◆ InitCharmInfo()

CharmInfo * Unit::InitCharmInfo ( )
15700{
15701 if (!m_charmInfo)
15702 m_charmInfo = new CharmInfo(this);
15703
15704 return m_charmInfo;
15705}
Definition: Unit.h:1094

References m_charmInfo.

Referenced by Guardian::Guardian(), Pet::Pet(), and SetCharmedBy().

◆ InitStatBuffMods()

void Unit::InitStatBuffMods ( )
inline
2030 {
2031 for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i) SetFloatValue(static_cast<uint16>(UNIT_FIELD_POSSTAT0) + i, 0);
2032 for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i) SetFloatValue(static_cast<uint16>(UNIT_FIELD_NEGSTAT0) + i, 0);
2033 }

References STAT_STRENGTH, UNIT_FIELD_NEGSTAT0, and UNIT_FIELD_POSSTAT0.

Referenced by Player::InitStatsForLevel().

◆ InitTamedPet()

bool Unit::InitTamedPet ( Pet pet,
uint8  level,
uint32  spell_id 
)
17530{
17531 Player* player = ToPlayer();
17532 PetStable& petStable = player->GetOrInitPetStable();
17533 if (petStable.CurrentPet || petStable.GetUnslottedHunterPet())
17534 return false;
17535
17536 pet->SetCreatorGUID(GetGUID());
17537 pet->SetFaction(GetFaction());
17538 pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id);
17539
17540 if (GetTypeId() == TYPEID_PLAYER)
17542
17543 if (!pet->InitStatsForLevel(level))
17544 {
17545 LOG_ERROR("entities.unit", "Pet::InitStatsForLevel() failed for creature (Entry: {})!", pet->GetEntry());
17546 return false;
17547 }
17548
17549 pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
17550 // this enables pet details window (Shift+P)
17551 pet->InitPetCreateSpells();
17552 pet->SetFullHealth();
17553 pet->FillPetInfo(&petStable.CurrentPet.emplace());
17554 return true;
17555}
@ UNIT_CREATED_BY_SPELL
Definition: UpdateFields.h:138
bool InitStatsForLevel(uint8 level)
Definition: Pet.cpp:1009
void FillPetInfo(PetStable::PetInfo *petInfo) const
Definition: Pet.cpp:2407
void InitPetCreateSpells()
Definition: Pet.cpp:2001
Definition: PetDefines.h:197
PetInfo const * GetUnslottedHunterPet() const
Definition: PetDefines.h:225
Optional< PetInfo > CurrentPet
Definition: PetDefines.h:220
PetStable & GetOrInitPetStable()
Definition: Player.cpp:15460
void SetPetNumber(uint32 petnumber, bool statwindow)
Definition: Unit.cpp:15914
void SetFullHealth()
Definition: Unit.h:1455
void SetFaction(uint32 faction)
Definition: Unit.cpp:10029
void ReplaceAllUnitFlags(UnitFlags flags)
Definition: Unit.h:1483
CharmInfo * GetCharmInfo()
Definition: Unit.h:1883
void SetCreatorGUID(ObjectGuid creator)
Definition: Unit.h:1817

References PetStable::CurrentPet, Pet::FillPetInfo(), GetCharmInfo(), Object::GetEntry(), GetFaction(), Object::GetGUID(), Player::GetOrInitPetStable(), Object::GetTypeId(), PetStable::GetUnslottedHunterPet(), Pet::InitPetCreateSpells(), Guardian::InitStatsForLevel(), LOG_ERROR, ReplaceAllUnitFlags(), SetCreatorGUID(), SetFaction(), SetFullHealth(), CharmInfo::SetPetNumber(), Object::SetUInt32Value(), sObjectMgr, Object::ToPlayer(), TYPEID_PLAYER, UNIT_CREATED_BY_SPELL, and UNIT_FLAG_PLAYER_CONTROLLED.

Referenced by CreateTamedPetFrom().

◆ InterruptNonMeleeSpells()

void Unit::InterruptNonMeleeSpells ( bool  withDelayed,
uint32  spellid = 0,
bool  withInstant = true,
bool  bySelf = false 
)
4070{
4071 // generic spells are interrupted if they are not finished or delayed
4072 if (m_currentSpells[CURRENT_GENERIC_SPELL] && (!spell_id || m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->Id == spell_id))
4073 InterruptSpell(CURRENT_GENERIC_SPELL, withDelayed, withInstant, bySelf);
4074
4075 // autorepeat spells are interrupted if they are not finished or delayed
4076 if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL] && (!spell_id || m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id == spell_id))
4077 InterruptSpell(CURRENT_AUTOREPEAT_SPELL, withDelayed, withInstant, bySelf);
4078
4079 // channeled spells are interrupted if they are not finished, even if they are delayed
4080 if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id == spell_id))
4081 InterruptSpell(CURRENT_CHANNELED_SPELL, true, true, bySelf);
4082}

References CURRENT_AUTOREPEAT_SPELL, CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, InterruptSpell(), and m_currentSpells.

Referenced by _EnterVehicle(), PetAI::_stopAttack(), Player::ActivateSpec(), npc_dark_nucleus::npc_dark_nucleusAI::AttackStart(), CleanupBeforeRemoveFromMap(), CombatStop(), npc_mograine::npc_mograineAI::DamageTaken(), boss_onyxia::DamageTaken(), boss_volazj::DamageTaken(), boss_jedoga_shadowseeker::DamageTaken(), boss_algalon_the_observer::boss_algalon_the_observerAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::DamageTaken(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::DamageTaken(), boss_alar::boss_alarAI::DamageTaken(), boss_taerar::boss_taerarAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), npc_warden_mellichar::npc_warden_mellicharAI::DamageTaken(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::DamageTaken(), DealDamage(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), npc_medivh_bm::npc_medivh_bmAI::DoAction(), boss_thorim_sif::boss_thorim_sifAI::DoAction(), boss_nazan::boss_nazanAI::DoAction(), npc_ranshalla::npc_ranshallaAI::DoContinueEscort(), Spell::EffectKnockBack(), boss_infinite_corruptor::boss_infinite_corruptorAI::EnterCombat(), boss_taldaram::EnterCombat(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::EnterCombat(), boss_urom::boss_uromAI::EnterCombat(), boss_thorim_runic_colossus::boss_thorim_runic_colossusAI::EnterCombat(), boss_kelidan_the_breaker::boss_kelidan_the_breakerAI::EnterCombat(), npc_shadowmoon_channeler::npc_shadowmoon_channelerAI::EnterCombat(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::EnterCombat(), boss_gal_darah::boss_gal_darahAI::EnterCombat(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::EnterCombat(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::EnterCombat(), violet_hold_trashAI::EnterCombat(), spell_dk_death_grip::HandleBaseDummy(), WorldSession::HandleCancelCastOpcode(), spell_magtheridon_shadow_grasp::spell_magtheridon_shadow_grasp_AuraScript::HandleDummyRemove(), AuraEffect::HandleFeignDeath(), WorldSession::HandleLootOpcode(), WorldSession::HandlePetActionHelper(), spell_the_lich_king_jump::spell_the_lich_king_jump_SpellScript::HandleScript(), boss_akilzon::boss_akilzonAI::HandleStormSequence(), PetAI::KilledUnit(), npc_hor_leader_second::npc_hor_leader_secondAI::MoveToNextStopPoint(), boss_malchezaar::boss_malchezaarAI::Phase2(), PretendToDie(), SmartScript::ProcessAction(), RemoveAurasWithInterruptFlags(), boss_varos::boss_varosAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), npc_putricide_oozeAI::SelectNewTarget(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), boss_anomalus::boss_anomalusAI::SetData(), setDeathState(), boss_shade_of_aran::boss_aranAI::SpellHit(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), boss_razorscale::boss_razorscaleAI::SpellHit(), StopAttackFaction(), Player::TeleportTo(), boss_archimonde::boss_archimondeAI::UnleashSoulCharge(), CasterAI::UpdateAI(), TotemAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_curator::boss_curatorAI::UpdateAI(), boss_shade_of_aran::boss_aranAI::UpdateAI(), npc_kilrek::npc_kilrekAI::UpdateAI(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::UpdateAI(), boss_high_inquisitor_whitemane::boss_high_inquisitor_whitemaneAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), boss_jeklik::UpdateAI(), boss_azgalor::boss_azgalorAI::UpdateAI(), hyjalAI::UpdateAI(), boss_paletress::boss_paletressAI::UpdateAI(), boss_novos::boss_novosAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), npc_dark_nucleus::npc_dark_nucleusAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), boss_pandemonius::boss_pandemoniusAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_shade_of_akama::boss_shade_of_akamaAI::UpdateAI(), boss_the_lurker_below::boss_the_lurker_belowAI::UpdateAI(), boss_magtheridon::boss_magtheridonAI::UpdateAI(), npc_warden_mellichar::npc_warden_mellicharAI::UpdateAI(), boss_high_botanist_freywinn::boss_high_botanist_freywinnAI::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), generic_creature::generic_creatureAI::UpdateAI(), boss_ichoron::boss_ichoronAI::UpdateAI(), and PetAI::UpdateAI().

◆ InterruptSpell()

void Unit::InterruptSpell ( CurrentSpellTypes  spellType,
bool  withDelayed = true,
bool  withInstant = true,
bool  bySelf = false 
)
4003{
4004 //LOG_DEBUG("entities.unit", "Interrupt spell for unit {}.", GetEntry());
4005 Spell* spell = m_currentSpells[spellType];
4006 if (spell
4007 && (withDelayed || spell->getState() != SPELL_STATE_DELAYED)
4008 && (withInstant || spell->GetCastTime() > 0 || spell->getState() == SPELL_STATE_CASTING)) // xinef: or spell is in casting state (channeled spells only)
4009 {
4010 // for example, do not let self-stun aura interrupt itself
4011 if (!spell->IsInterruptable())
4012 return;
4013
4014 // send autorepeat cancel message for autorepeat spells
4015 if (spellType == CURRENT_AUTOREPEAT_SPELL)
4016 if (GetTypeId() == TYPEID_PLAYER)
4018
4019 if (spell->getState() != SPELL_STATE_FINISHED)
4020 spell->cancel(bySelf);
4021
4022 m_currentSpells[spellType] = nullptr;
4023 spell->SetReferencedFromCurrent(false);
4024 }
4025}
@ SPELL_STATE_DELAYED
Definition: Spell.h:228
void SendAutoRepeatCancel(Unit *target)
Definition: PlayerMisc.cpp:152
bool IsInterruptable() const
Definition: Spell.h:559
int32 GetCastTime() const
Definition: Spell.h:547
uint32 getState() const
Definition: Spell.h:482
void cancel(bool bySelf=false)
Definition: Spell.cpp:3693

References Spell::cancel(), CURRENT_AUTOREPEAT_SPELL, Spell::GetCastTime(), Spell::getState(), Object::GetTypeId(), Spell::IsInterruptable(), m_currentSpells, Player::SendAutoRepeatCancel(), Spell::SetReferencedFromCurrent(), SPELL_STATE_CASTING, SPELL_STATE_DELAYED, SPELL_STATE_FINISHED, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by _UpdateAutoRepeatSpell(), Player::ActivateTaxiPathTo(), Attack(), AttackStop(), CastStop(), Spell::EffectInterruptCast(), Spell::EffectSanctuary(), boss_archimonde::boss_archimondeAI::EnterCombat(), SmartAI::EnterCombat(), AuraEffect::HandleAuraModSilence(), WorldSession::HandleCancelAuraOpcode(), WorldSession::HandleCancelAutoRepeatSpellOpcode(), WorldSession::HandleCancelCastOpcode(), WorldSession::HandleCancelChanneling(), spell_hun_scatter_shot::HandleDummy(), AuraEffect::HandleFeignDeath(), InterruptNonMeleeSpells(), Player::RemoveItemDependentAurasAndCasts(), SetCurrentCastedSpell(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::SetData(), boss_nightbane::boss_nightbaneAI::TakeOff(), and npc_belnistrasz::npc_belnistraszAI::UpdateAI().

◆ IsAlive()

bool Unit::IsAlive ( ) const
inline
1808{ return (m_deathState == ALIVE); };

References ALIVE, and m_deathState.

Referenced by _CreateAuraApplication(), CreatureAI::_EnterEvadeMode(), _EnterVehicle(), _IsValidAssistTarget(), _IsValidAttackTarget(), Player::_LoadItem(), BossAI::_Reset(), WorldBossAI::_Reset(), KillRewarder::_RewardHonor(), KillRewarder::_RewardKillCredit(), KillRewarder::_RewardXP(), PetAI::_stopAttack(), AddAura(), Map::AddPlayerToMap(), HostileReference::AddThreat(), Spell::AddUnitTarget(), Attack(), PetAI::AttackedBy(), AttackerStateUpdate(), boss_freya::boss_freyaAI::boss_freyaAI(), boss_hodir::boss_hodirAI::boss_hodirAI(), boss_mimiron::boss_mimironAI::boss_mimironAI(), boss_thorim::boss_thorimAI::boss_thorimAI(), WorldSession::BuildPartyMemberStatsChangedPacket(), Player::BuyItemFromVendorSlot(), CalcAbsorbResist(), CalculateMeleeDamage(), CalculateSpellDamageTaken(), instance_ruins_of_ahnqiraj::instance_ruins_of_ahnqiraj_InstanceMapScript::CallNextRajaxxLeader(), Creature::CanAssistTo(), PetAI::CanAttack(), Player::CanCaptureTowerPoint(), CanHaveThreatList(), Player::CanInteractWithQuestGiver(), Player::CanUseAmmo(), Player::CanUseBattlegroundObject(), boss_archimonde::boss_archimondeAI::CanUseFingerOfDeath(), Player::CanUseItem(), Player::CastItemCombatSpell(), Player::CheckAreaExploreAndOutdoor(), spell_hun_check_pet_los::CheckCast(), spell_hun_pet_heart_of_the_phoenix::CheckCast(), spell_hun_bestial_wrath::CheckCast(), Spell::CheckCast(), boss_gothik::boss_gothikAI::CheckGroupSplitted(), BattlegroundRV::CheckPositionForUnit(), spell_mage_focus_magic::CheckProc(), spell_dk_blood_caked_blade::CheckProc(), spell_dk_dancing_rune_weapon::CheckProc(), spell_item_necrotic_touch::CheckProc(), spell_pal_seal_of_righteousness::CheckProc(), spell_warl_siphon_life::CheckProc(), spell_putricide_mutation_init::spell_putricide_mutation_init_SpellScript::CheckRequirementInternal(), SpellInfo::CheckTarget(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::CheckTombReset(), CreatureUnitRelocationWorker(), DealDamage(), DealDamageMods(), DealMeleeDamage(), DealSpellDamage(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DestroyDoor(), Creature::DisappearAndDie(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), npc_xerestrasza::npc_xerestraszaAI::DoAction(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), boss_sister_svalna::boss_sister_svalnaAI::DoAction(), boss_high_king_maulgar::boss_high_king_maulgarAI::DoAction(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::DoAction(), boss_infinite_corruptor::boss_infinite_corruptorAI::DoAction(), boss_tharon_ja::boss_tharon_jaAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_xt002::boss_xt002AI::DoAction(), boss_ichoron::boss_ichoronAI::DoAction(), boss_illidari_council::boss_illidari_councilAI::DoAction(), boss_kelidan_the_breaker::boss_kelidan_the_breakerAI::DoAction(), Spell::DoAllEffectOnTarget(), spell_hun_masters_call::DoCheckCast(), RandomMovementGenerator< T >::DoInitialize(), WorldSession::DoLootRelease(), WaypointMovementGenerator< Creature >::DoUpdate(), instance_blackrock_spire::instance_blackrock_spireMapScript::Dragonspireroomcheck(), Spell::EffectAddExtraAttacks(), Spell::EffectEnergize(), Spell::EffectEnergizePct(), Spell::EffectEnvironmentalDMG(), Spell::EffectFeedPet(), Spell::EffectHeal(), Spell::EffectHealMaxHealth(), Spell::EffectHealMechanical(), Spell::EffectHealPct(), Spell::EffectHealthLeech(), Spell::EffectInstaKill(), Spell::EffectInterruptCast(), Spell::EffectPowerBurn(), Spell::EffectPowerDrain(), Spell::EffectResurrect(), Spell::EffectResurrectNew(), Spell::EffectResurrectPet(), Spell::EffectSchoolDMG(), Spell::EffectScriptEffect(), Spell::EffectSelfResurrect(), Spell::EffectSkinPlayerCorpse(), Spell::EffectStuck(), Spell::EffectThreat(), Spell::EffectWeaponDmg(), boss_malchezaar::boss_malchezaarAI::EnfeebleResetHealth(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::EnterCombat(), boss_freya::boss_freyaAI::EnterCombat(), boss_sartharion::boss_sartharionAI::EnterCombat(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::EnterEvadeMode(), npc_tirion_fordring_tft::npc_tirion_fordringAI::EnterEvadeMode(), GuardAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), npc_terenas_menethil::npc_terenas_menethilAI::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), hyjalAI::EnterEvadeMode(), Player::EnvironmentalDamage(), Player::EquipItem(), BattleExperienceEvent::Execute(), DelayedMovementEvent::Execute(), IceTombSummonEvent::Execute(), SACActivateEvent::Execute(), boss_sartharion_tenebron::boss_sartharion_tenebronAI::ExecuteEvent(), AssistanceMovementGenerator::Finalize(), boss_shade_of_aran::boss_aranAI::FlameWreathEffect(), Creature::ForcedDespawn(), CreatureGroup::FormationReset(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::GetData(), GetDebugInfo(), Player::GetInitialVisiblePackets(), FollowerAI::GetLeaderForFollower(), Player::getMaxTimer(), CreatureGroup::GetNewTargetForMember(), Player::GetNPCIfCanInteractWith(), GetPartyMembers(), npc_air_force_bots::npc_air_force_botsAI::GetSummonedGuard(), npc_wild_wyrm::npc_wild_wyrmAI::GetValidPlayer(), Pet::GivePetXP(), Player::GiveXP(), go_wind_stone::go_wind_stoneAI::GossipSelect(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), BattlegroundEY::HandleAreaTrigger(), BattlegroundWS::HandleAreaTrigger(), WorldSession::HandleAreaTriggerOpcode(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModIncreaseHealthPercent(), AuraEffect::HandleAuraModTotalThreat(), WorldSession::HandleAutostoreLootItemOpcode(), WorldSession::HandleBattleFieldPortOpcode(), misc_commandscript::HandleDamageCommand(), misc_commandscript::HandleDieCommand(), Player::HandleDrowning(), HandleDummyAuraProc(), WorldSession::HandleEmoteOpcode(), Player::HandleFall(), misc_commandscript::HandleFreezeCommand(), WorldSession::HandleInitiateTradeOpcode(), WorldSession::HandleLootMoneyOpcode(), WorldSession::HandleMessagechatOpcode(), AuraEffect::HandleModTaunt(), AuraEffect::HandleModTotalPercentStat(), WorldSession::HandleMovementOpcodes(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetWanderDistanceCommand(), AuraEffect::HandleObsModPowerAuraTick(), spell_yogg_saron_brain_link::spell_yogg_saron_brain_link_AuraScript::HandleOnEffectApply(), WorldSession::HandleOpenItemOpcode(), HandleOverrideClassScriptAuraProc(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), WorldSession::HandlePetAction(), WorldSession::HandlePetCancelAuraOpcode(), WorldSession::HandlePetStopAttack(), misc_commandscript::HandlePInfoCommand(), spell_pal_seal_of_command_aura::HandleProc(), HandleProcTriggerSpell(), WorldSession::HandleReclaimCorpseOpcode(), WorldSession::HandleRepopRequestOpcode(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), WorldSession::HandleSetAmmoOpcode(), WorldSession::HandleSetRaidDifficultyOpcode(), misc_commandscript::HandleSkirmishCommand(), ArenaSpectator::HandleSpectatorSpectateCommand(), ArenaSpectator::HandleSpectatorWatchCommand(), AuraEffect::HandleSpiritOfRedemption(), WorldSession::HandleStablePet(), WorldSession::HandleStableSwapPet(), WorldSession::HandleSummonResponseOpcode(), WorldSession::HandleUnstablePet(), boss_prince_keleseth_icc::boss_prince_kelesethAI::InitializeAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::InitializeAI(), boss_prince_valanar_icc::boss_prince_valanarAI::InitializeAI(), boss_moroes::InitializeGuests(), Player::IsAtGroupRewardDistance(), Player::IsAtRecruitAFriendDistance(), Creature::IsInvisibleDueToDespawn(), Player::IsOutdoorPvPActive(), Player::IsPetNeedBeTemporaryUnsummoned(), isTargetableForAttack(), IsValidCombatTarget(), Spell::IsValidDeadOrAliveTarget(), ThreatCalcHelper::isValidProcess(), npc_kilrek::npc_kilrekAI::JustDied(), npc_tito::npc_titoAI::JustDied(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::JustDied(), boss_rajaxx::JustDied(), boss_twilight_halion::boss_twilight_halionAI::JustDied(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::JustReachedHome(), boss_rotface::boss_rotfaceAI::JustSummoned(), Kill(), boss_hadronox::boss_hadronoxAI::KilledUnit(), boss_gluth::boss_gluthAI::KilledUnit(), CreatureGroup::LeaderMoveTo(), Player::LoadCorpse(), Player::LoadFromDB(), MagicSpellHitResult(), AchievementCriteriaData::Meets(), CreatureGroup::MemberEngagingTarget(), CreatureGroup::MemberEvaded(), npc_twiggy_flathead::npc_twiggy_flatheadAI::MoveInLineOfSight(), boss_lord_marrowgar::MoveInLineOfSight(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::MoveInLineOfSight(), boss_kelthuzad::boss_kelthuzadAI::MoveInLineOfSight(), deathblow_to_the_legion_trigger::deathblow_to_the_legion_triggerAI::MoveInLineOfSight(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::OnCreatureCreate(), instance_karazhan::instance_karazhan_InstanceMapScript::OnCreatureCreate(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnCreatureCreate(), instance_uldaman::instance_uldaman_InstanceMapScript::OnCreatureCreate(), instance_temple_of_ahnqiraj::instance_temple_of_ahnqiraj_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript::OnCreatureCreate(), instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript::OnCreatureCreate(), go_palehoof_sphere::OnGossipHello(), go_jotunheim_cage::OnGossipHello(), go_dragonflayer_cage::OnGossipHello(), go_prince_taldaram_sphere::OnGossipHello(), spell_yogg_saron_brain_link::spell_yogg_saron_brain_link_AuraScript::OnPeriodic(), instance_violet_hold::instance_violet_hold_InstanceMapScript::OnPlayerEnter(), instance_eye_of_eternity::instance_eye_of_eternity_InstanceMapScript::OnPlayerEnter(), at_orb_of_command::OnTrigger(), at_ancient_leaf::OnTrigger(), at_naxxramas_hub_portal::OnTrigger(), AreaTrigger_at_celestial_planetarium_enterance::OnTrigger(), AreaTrigger_at_voltarus_middle::OnTrigger(), AreaTrigger_at_legion_teleporter::OnTrigger(), AreaTrigger_at_nats_landing::OnTrigger(), AreaTrigger_at_sentry_point::OnTrigger(), SmartTrigger::OnTrigger(), AreaTrigger_at_area_52_entrance::OnTrigger(), at_dragonspire_hall::OnTrigger(), at_blackrock_stadium::OnTrigger(), near_scarshield_infiltrator::OnTrigger(), at_scarshield_infiltrator::OnTrigger(), at_commander_dawnforge::OnTrigger(), RisenArchmageCheck::operator()(), WretchedGhoulCleaner::operator()(), ValithriaDespawner::operator()(), Acore::NearestCreatureEntryWithLiveStateInObjectRangeCheck::operator()(), Acore::PlayerAtMinimumRangeAway::operator()(), Acore::AnyDeadUnitObjectInRangeCheck::operator()(), Acore::AnyPlayerInObjectRangeCheck::operator()(), Acore::NearestPlayerInObjectRangeCheck::operator()(), Acore::MostHPMissingInRange::operator()(), Acore::MostHPPercentMissingInRange::operator()(), Acore::FriendlyCCedInRange::operator()(), Acore::FriendlyMissingBuffInRange::operator()(), Acore::AnyUnfriendlyUnitInObjectRangeCheck::operator()(), Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck::operator()(), Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator()(), Acore::AnyFriendlyUnitInObjectRangeCheck::operator()(), Acore::AnyFriendlyNotSelfUnitInObjectRangeCheck::operator()(), Acore::AnyGroupedUnitInObjectRangeCheck::operator()(), Acore::AnyUnitInObjectRangeCheck::operator()(), Acore::AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck::operator()(), Acore::AnyDeadUnitCheck::operator()(), Acore::AllFriendlyCreaturesInGrid::operator()(), Acore::MostHPMissingGroupInRange::operator()(), FrostwingVrykulSearcher::operator()(), Acore::AllDeadCreaturesInRange::operator()(), ShadowTrapLKTargetSelector::operator()(), NonTankLKTargetSelector::operator()(), DefileTargetSelector::operator()(), Acore::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck::operator()(), PetAI::OwnerAttacked(), npc_pet_gen_valkyr_guardian::OwnerAttacked(), PetAI::OwnerAttackedBy(), npc_wild_wyrm::npc_wild_wyrmAI::PassengerBoarded(), npc_eoe_wyrmrest_skytalon::npc_eoe_wyrmrest_skytalonAI::PassengerBoarded(), boss_kologarn::boss_kologarnAI::PassengerBoarded(), MapMgr::PlayerCannotEnter(), ProcDamageAndSpell(), RemoveCharmedBy(), Group::RemoveMember(), Player::RemovePet(), Battleground::RemovePlayerAtLeave(), Player::RepopAtGraveyard(), instance_blood_furnace::instance_blood_furnace_InstanceMapScript::ResetPrisoner(), Creature::Respawn(), Player::RewardPlayerAndGroupAtEvent(), boss_gluth::boss_gluthAI::SelectPlayerInRoom(), Player::SendLoot(), npc_corrupted_totem::SetAura(), instance_naxxramas::instance_naxxramas_InstanceMapScript::SetBossState(), SetConfused(), boss_emperor_dagran_thaurissan::boss_draganthaurissanAI::SetData(), instance_ahnkahet::instance_ahnkahet_InstanceScript::SetData(), npc_enslaved_proto_drake::npc_enslaved_proto_drakeAI::SetData(), npc_pos_tyrannus_events::npc_pos_tyrannus_eventsAI::SetData(), boss_teron_gorefiend::boss_teron_gorefiendAI::SetData(), Player::setDeathState(), Creature::SetDisableGravity(), SetFeared(), Creature::SetHover(), SetInCombatState(), SetStunned(), Battlefield::ShowNpc(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::SpawnAdds(), npc_dark_iron_guzzler::SpellHit(), npc_crusade_persuaded::npc_crusade_persuadedAI::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), npc_hor_lich_king::npc_hor_lich_kingAI::SpellHitTarget(), npc_oculus_drake::npc_oculus_drakeAI::SpellHitTarget(), WaypointMovementGenerator< Creature >::StartMove(), PassengerController::SummonCreatures(), boss_rend_blackhand::boss_rend_blackhandAI::SummonedCreatureDespawn(), boss_priestess_delrissa::boss_priestess_delrissaAI::SummonedCreatureDies(), boss_kaelthas::boss_kaelthasAI::SummonedCreatureDies(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), Player::SwapItem(), lfg::LFGMgr::TeleportPlayer(), BattlegroundRV::TeleportUnitToNewZ(), Pet::Update(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), Creature::Update(), TempSummon::Update(), Puppet::Update(), Player::Update(), Totem::Update(), Update(), TimedFleeingMovementGenerator::Update(), TotemAI::UpdateAI(), boss_terestian_illhoof::boss_terestianAI::UpdateAI(), boss_julianne::boss_julianneAI::UpdateAI(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), boss_akilzon::boss_akilzonAI::UpdateAI(), npc_dark_iron_guzzler::UpdateAI(), npc_giant_infernal::npc_giant_infernalAI::UpdateAI(), hyjalAI::UpdateAI(), npc_time_rift::npc_time_riftAI::UpdateAI(), npc_shay_leafrunner::npc_shay_leafrunnerAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_taldaram::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), npc_bone_spike::npc_bone_spikeAI::UpdateAI(), npc_ice_tomb::npc_ice_tombAI::UpdateAI(), boss_sjonnir_malformed_ooze::boss_sjonnir_malformed_oozeAI::UpdateAI(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::UpdateAI(), boss_vezax::boss_vezaxAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::UpdateAI(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::UpdateAI(), boss_erekem::boss_erekemAI::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), generic_creature::generic_creatureAI::UpdateAI(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::UpdateAI(), PetAI::UpdateAI(), npc_injured_patient::npc_injured_patientAI::UpdateAI(), npc_tooga::npc_toogaAI::UpdateFollowerAI(), npc_ringo::npc_ringoAI::UpdateFollowerAI(), InstanceScript::UpdateMinionState(), Creature::UpdateMovementFlags(), boss_netherspite::boss_netherspiteAI::UpdatePortals(), boss_twin_valkyrAI::UpdateSharedHealth(), UpdateSplineMovement(), Player::UpdateZone(), boss_anetheron::boss_anetheronAI::WaypointReached(), boss_azgalor::boss_azgalorAI::WaypointReached(), boss_kazrogal::boss_kazrogalAI::WaypointReached(), boss_rage_winterchill::boss_rage_winterchillAI::WaypointReached(), npc_giant_infernal::npc_giant_infernalAI::WaypointReached(), npc_abomination::npc_abominationAI::WaypointReached(), npc_ghoul::npc_ghoulAI::WaypointReached(), npc_necromancer::npc_necromancerAI::WaypointReached(), npc_banshee::npc_bansheeAI::WaypointReached(), npc_crypt_fiend::npc_crypt_fiendAI::WaypointReached(), npc_fel_stalker::npc_fel_stalkerAI::WaypointReached(), npc_frost_wyrm::npc_frost_wyrmAI::WaypointReached(), npc_gargoyle::npc_gargoyleAI::WaypointReached(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ IsAlwaysDetectableFor()

bool Unit::IsAlwaysDetectableFor ( WorldObject const *  seer) const
overrideprotectedvirtual

Reimplemented from WorldObject.

14117{
14119 return true;
14120
14121 if (HasAuraTypeWithCaster(SPELL_AURA_MOD_STALKED, seer->GetGUID()))
14122 return true;
14123
14124 if (Player* ownerPlayer = GetSpellModOwner())
14125 if (Player const* seerPlayer = seer->ToPlayer())
14126 {
14127 if (ownerPlayer->IsGroupVisibleFor(seerPlayer))
14128 return true;
14129 }
14130
14131 return false;
14132}
virtual bool IsAlwaysDetectableFor(WorldObject const *) const
Definition: Object.h:651

References Object::GetGUID(), GetSpellModOwner(), HasAuraTypeWithCaster(), WorldObject::IsAlwaysDetectableFor(), SPELL_AURA_MOD_STALKED, and Object::ToPlayer().

Referenced by Creature::IsAlwaysDetectableFor(), and Player::IsAlwaysDetectableFor().

◆ IsAlwaysVisibleFor()

bool Unit::IsAlwaysVisibleFor ( WorldObject const *  seer) const
overrideprotectedvirtual

Reimplemented from WorldObject.

14098{
14100 return true;
14101
14102 // Always seen by owner
14103 if (ObjectGuid guid = GetCharmerOrOwnerGUID())
14104 if (seer->GetGUID() == guid)
14105 return true;
14106
14107 if (Player const* seerPlayer = seer->ToPlayer())
14108 if (Unit* owner = GetOwner())
14109 if (Player* ownerPlayer = owner->ToPlayer())
14110 if (ownerPlayer->IsGroupVisibleFor(seerPlayer))
14111 return true;
14112
14113 return false;
14114}
virtual bool IsAlwaysVisibleFor(WorldObject const *) const
Definition: Object.h:648

References GetCharmerOrOwnerGUID(), Object::GetGUID(), GetOwner(), WorldObject::IsAlwaysVisibleFor(), and Object::ToPlayer().

◆ IsArmorer()

bool Unit::IsArmorer ( ) const
inline
@ UNIT_NPC_FLAG_REPAIR
Definition: Unit.h:528
bool HasNpcFlag(NPCFlags flags) const
Definition: Unit.h:1646

References HasNpcFlag(), and UNIT_NPC_FLAG_REPAIR.

◆ isAttackingPlayer()

bool Unit::isAttackingPlayer ( ) const
10426{
10428 return true;
10429
10430 if (!m_Controlled.empty())
10431 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
10432 if ((*itr)->isAttackingPlayer())
10433 return true;
10434
10435 for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
10436 if (m_SummonSlot[i])
10437 if (Creature* summon = GetMap()->GetCreature(m_SummonSlot[i]))
10438 if (summon->isAttackingPlayer())
10439 return true;
10440
10441 return false;
10442}

References WorldObject::GetMap(), HasUnitState(), m_Controlled, m_SummonSlot, MAX_SUMMON_SLOT, and UNIT_STATE_ATTACK_PLAYER.

◆ isAttackReady()

bool Unit::isAttackReady ( WeaponAttackType  type = BASE_ATTACK) const
inline

◆ IsAuctioner()

bool Unit::IsAuctioner ( ) const
inline
@ UNIT_NPC_FLAG_AUCTIONEER
Definition: Unit.h:537

References HasNpcFlag(), and UNIT_NPC_FLAG_AUCTIONEER.

◆ IsBanker()

bool Unit::IsBanker ( ) const
inline
@ UNIT_NPC_FLAG_BANKER
Definition: Unit.h:533

References HasNpcFlag(), and UNIT_NPC_FLAG_BANKER.

◆ IsBattleMaster()

bool Unit::IsBattleMaster ( ) const
inline

◆ isBeingLoaded()

virtual bool Unit::isBeingLoaded ( ) const
inlinevirtual

Reimplemented in Pet, and Player.

2395{ return false;}

Referenced by Player::SetMover().

◆ isBlockCritical()

bool Unit::isBlockCritical ( )
3081{
3083 return true;
3084 return false;
3085}
@ SPELL_AURA_MOD_BLOCK_CRIT_CHANCE
Definition: SpellAuraDefines.h:316

References GetTotalAuraModifier(), roll_chance_i(), and SPELL_AURA_MOD_BLOCK_CRIT_CHANCE.

Referenced by CalculateMeleeDamage(), and CalculateSpellDamageTaken().

◆ IsCharmed()

◆ IsCharmedOwnedByPlayerOrPlayer()

bool Unit::IsCharmedOwnedByPlayerOrPlayer ( ) const
inline
ObjectGuid GetCharmerOrOwnerOrOwnGUID() const
Definition: Unit.h:1831

References GetCharmerOrOwnerOrOwnGUID(), and ObjectGuid::IsPlayer().

Referenced by Spell::DoSpellHitOnUnit(), and ProcDamageAndSpellFor().

◆ IsContestedGuard()

bool Unit::IsContestedGuard ( ) const
inline
1510 {
1511 if (FactionTemplateEntry const* entry = GetFactionTemplateEntry())
1512 return entry->IsContestedGuardFaction();
1513
1514 return false;
1515 }

References GetFactionTemplateEntry().

Referenced by Acore::NearestVisibleDetectableContestedGuardUnitCheck::operator()().

◆ IsControllableGuardian()

bool Unit::IsControllableGuardian ( ) const
inline

◆ IsControlledByPlayer()

◆ IsCreatedByPlayer()

bool Unit::IsCreatedByPlayer ( ) const
inline
1829{ return m_CreatedByPlayer; }

References m_CreatedByPlayer.

Referenced by DealDamage().

◆ IsCritter()

◆ IsDamageReducedByArmor()

bool Unit::IsDamageReducedByArmor ( SpellSchoolMask  damageSchoolMask,
SpellInfo const *  spellInfo = nullptr,
uint8  effIndex = MAX_SPELL_EFFECTS 
)
static
1979{
1980 // only physical spells damage gets reduced by armor
1981 if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0)
1982 return false;
1983 if (spellInfo)
1984 {
1985 // there are spells with no specific attribute but they have "ignores armor" in tooltip
1986 if (spellInfo->HasAttribute(SPELL_ATTR0_CU_IGNORE_ARMOR))
1987 return false;
1988
1989 // bleeding effects are not reduced by armor
1990 if (effIndex != MAX_SPELL_EFFECTS)
1991 {
1992 if (spellInfo->Effects[effIndex].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE ||
1993 spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_SCHOOL_DAMAGE)
1994 if (spellInfo->GetEffectMechanicMask(effIndex) & (1 << MECHANIC_BLEED))
1995 return false;
1996 }
1997 }
1998 return true;
1999}
@ SPELL_ATTR0_CU_IGNORE_ARMOR
Definition: SpellInfo.h:191
@ MECHANIC_BLEED
Definition: SharedDefines.h:1312

References SpellInfo::Effects, SpellInfo::GetEffectMechanicMask(), SpellInfo::HasAttribute(), MAX_SPELL_EFFECTS, MECHANIC_BLEED, SPELL_ATTR0_CU_IGNORE_ARMOR, SPELL_AURA_PERIODIC_DAMAGE, SPELL_EFFECT_SCHOOL_DAMAGE, and SPELL_SCHOOL_MASK_NORMAL.

Referenced by CalculateMeleeDamage(), CalculateSpellDamageTaken(), AuraEffect::HandlePeriodicDamageAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ isDead()

bool Unit::isDead ( ) const
inline
1810{ return (m_deathState == DEAD || m_deathState == CORPSE); };
@ CORPSE
Definition: Unit.h:318
@ DEAD
Definition: Unit.h:319

References CORPSE, DEAD, and m_deathState.

Referenced by npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI::CheckEventFail(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::CheckEventFail(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), Spell::EffectSummonPet(), AuraEffect::HandleAuraDummy(), Player::HandleFall(), boss_malygos::boss_malygosAI::HandleIntroSpeech(), misc_commandscript::HandleRespawnCommand(), spell_prince_taldaram_conjure_flame_sphere::HandleScript(), Creature::HasSpellFocus(), UnitAI::InitializeAI(), SmartAI::InitializeAI(), npc_troll_volunteer::npc_troll_volunteerAI::InitializeAI(), npc_spinestalker::npc_spinestalkerAI::InitializeAI(), npc_rimefang::npc_rimefangAI::InitializeAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::InitializeAI(), npc_ulduar_mimiron_rocket::npc_ulduar_mimiron_rocketAI::InitializeAI(), npc_bushwhacker::npc_bushwhackerAI::InitializeAI(), Player::isAllowedToLoot(), npc_anubisath_sentinel::aqsentinelAI::JustDied(), Player::OnGossipSelect(), AreaTrigger_at_stormwright_shelf::OnTrigger(), AreaTrigger_at_scent_larkorwi::OnTrigger(), at_bring_your_orphan_to::OnTrigger(), AreaTrigger_at_sholazar_waygate::OnTrigger(), Player::PrepareGossipMenu(), SmartScript::ProcessAction(), Player::RepopAtGraveyard(), npc_anubisath_sentinel::aqsentinelAI::Reset(), instance_molten_core::instance_molten_core_InstanceMapScript::SetBossState(), boss_kelidan_the_breaker::boss_kelidan_the_breakerAI::SummonChannelers(), npc_towering_infernal::npc_towering_infernalAI::UpdateAI(), npc_lesser_doomguard::npc_lesser_doomguardAI::UpdateAI(), and npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI().

◆ IsDuringRemoveFromWorld()

◆ isDying()

bool Unit::isDying ( ) const
inline
1809{ return (m_deathState == JUST_DIED); };

References JUST_DIED, and m_deathState.

Referenced by CanHaveThreatList(), and SetHover().

◆ IsEngaged()

◆ IsEngagedBy()

bool Unit::IsEngagedBy ( Unit const *  who) const
inline
1686{ return IsInCombatWith(who); }

References IsInCombatWith().

Referenced by Creature::_IsTargetAcceptable(), and Creature::Update().

◆ IsFalling()

bool Unit::IsFalling ( ) const

◆ isFeared()

◆ IsFFAPvP()

bool Unit::IsFFAPvP ( ) const
inline

◆ IsFlying()

◆ IsFriendlyTo()

bool Unit::IsFriendlyTo ( Unit const *  unit) const
10215{
10216 return GetReactionTo(unit) >= REP_FRIENDLY;
10217}

References GetReactionTo(), and REP_FRIENDLY.

Referenced by Spell::_cast(), AuraApplication::_InitFlags(), Creature::_IsTargetAcceptable(), FollowerAI::AssistPlayerInCombatAgainst(), npc_bartleby::npc_bartlebyAI::AttackedBy(), npc_calvin_montague::npc_calvin_montagueAI::AttackedBy(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::AttackedBy(), Creature::CanAssistTo(), spell_dk_death_coil::CheckCast(), spell_pal_holy_shock::CheckCast(), spell_pri_penance::CheckCast(), Spell::CheckCast(), Spell::DoAllEffectOnTarget(), Spell::DoSpellHitOnUnit(), Spell::EffectDispel(), Spell::EffectDispelMechanic(), Spell::EffectStealBeneficialBuff(), Spell::EffectThreat(), Aura::HandleAuraSpecificMods(), spell_dk_death_coil::HandleDummy(), spell_pal_holy_shock::HandleDummy(), spell_pri_penance::HandleDummy(), HandleDummyAuraProc(), BattlefieldWG::HandleKill(), spell_winter_veil_shoot_air_rifle::HandleScriptEffect(), WorldSession::HandleSetSelectionOpcode(), Spell::HandleThreatSpells(), GameObject::IsAlwaysVisibleFor(), SpellClickInfo::IsFitToRequirements(), npc_draenei_survivor::npc_draenei_survivorAI::MoveInLineOfSight(), Acore::AnyUnfriendlyUnitInObjectRangeCheck::operator()(), Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck::operator()(), Acore::AnyFriendlyUnitInObjectRangeCheck::operator()(), Acore::AnyFriendlyNotSelfUnitInObjectRangeCheck::operator()(), Acore::AllFriendlyCreaturesInGrid::operator()(), Acore::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck::operator()(), Acore::WorldObjectSpellTargetCheck::operator()(), PetSpellFail(), SmartScript::ProcessEvent(), RemoveCharmedBy(), Spell::SelectExplicitTargets(), Player::SendLoot(), Acore::MessageDistDelivererToHostile::SendPacket(), and TotemAI::UpdateAI().

◆ isFrozen()

◆ IsFullHealth()

◆ IsGossip()

bool Unit::IsGossip ( ) const
inline

◆ IsGuardian()

◆ IsGuildMaster()

bool Unit::IsGuildMaster ( ) const
inline
@ UNIT_NPC_FLAG_PETITIONER
Definition: Unit.h:534

References HasNpcFlag(), and UNIT_NPC_FLAG_PETITIONER.

◆ IsHostileTo()

◆ IsHostileToPlayers()

bool Unit::IsHostileToPlayers ( ) const
10220{
10221 FactionTemplateEntry const* my_faction = GetFactionTemplateEntry();
10222 if (!my_faction || !my_faction->faction)
10223 return false;
10224
10225 FactionEntry const* raw_faction = sFactionStore.LookupEntry(my_faction->faction);
10226 if (raw_faction && raw_faction->reputationListID >= 0)
10227 return false;
10228
10229 return my_faction->IsHostileToPlayers();
10230}
int32 reputationListID
Definition: DBCStructure.h:900
uint32 faction
Definition: DBCStructure.h:932
bool IsHostileToPlayers() const
Definition: DBCStructure.h:972

References FactionTemplateEntry::faction, GetFactionTemplateEntry(), FactionTemplateEntry::IsHostileToPlayers(), FactionEntry::reputationListID, and sFactionStore.

◆ IsHovering()

◆ IsHunterPet()

◆ IsImmunedToDamage() [1/3]

bool Unit::IsImmunedToDamage ( Spell const *  spell) const
12712{
12713 SpellInfo const* spellInfo = spell->GetSpellInfo();
12714 if (!spellInfo)
12715 {
12716 return false;
12717 }
12718
12720 {
12721 return false;
12722 }
12723
12725 {
12726 return false;
12727 }
12728
12729 uint32 schoolMask = spell->GetSpellSchoolMask();
12730 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
12731 {
12732 return false;
12733 }
12734
12735 // If m_immuneToDamage type contain magic, IMMUNE damage.
12736 SpellImmuneList const& damageList = m_spellImmune[IMMUNITY_DAMAGE];
12737 for (SpellImmuneList::const_iterator itr = damageList.begin(); itr != damageList.end(); ++itr)
12738 {
12739 if ((itr->type & schoolMask) == schoolMask)
12740 {
12741 return true;
12742 }
12743 }
12744
12745 return false;
12746}
std::vector< SpellImmune > SpellImmuneList
Definition: SpellDefines.h:179
@ SPELL_ATTR2_NO_SCHOOL_IMMUNITIES
Definition: SharedDefines.h:454
@ SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS
Definition: SharedDefines.h:407
@ IMMUNITY_DAMAGE
Definition: SharedDefines.h:1369
@ SPELL_SCHOOL_MASK_NONE
Definition: SharedDefines.h:268

References Spell::GetSpellInfo(), Spell::GetSpellSchoolMask(), SpellInfo::HasAttribute(), HasAuraType(), IMMUNITY_DAMAGE, m_spellImmune, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS, SPELL_ATTR2_NO_SCHOOL_IMMUNITIES, SPELL_AURA_SPIRIT_OF_REDEMPTION, and SPELL_SCHOOL_MASK_NONE.

◆ IsImmunedToDamage() [2/3]

bool Unit::IsImmunedToDamage ( SpellInfo const *  spellInfo) const
12680{
12681 if (!spellInfo)
12682 {
12683 return false;
12684 }
12685
12687 {
12688 return false;
12689 }
12690
12691 if (spellInfo->HasAttribute(SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS) || spellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
12692 {
12693 return false;
12694 }
12695
12696 uint32 schoolMask = spellInfo->GetSchoolMask();
12697 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
12698 {
12699 return false;
12700 }
12701
12702 // If m_immuneToDamage type contain magic, IMMUNE damage.
12703 SpellImmuneList const& damageList = m_spellImmune[IMMUNITY_DAMAGE];
12704 for (SpellImmuneList::const_iterator itr = damageList.begin(); itr != damageList.end(); ++itr)
12705 if((itr->type & schoolMask) == schoolMask)
12706 return true;
12707
12708 return false;
12709}

References SpellInfo::GetSchoolMask(), SpellInfo::HasAttribute(), HasAuraType(), IMMUNITY_DAMAGE, m_spellImmune, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS, SPELL_ATTR2_NO_SCHOOL_IMMUNITIES, SPELL_AURA_SPIRIT_OF_REDEMPTION, and SPELL_SCHOOL_MASK_NONE.

◆ IsImmunedToDamage() [3/3]

bool Unit::IsImmunedToDamage ( SpellSchoolMask  meleeSchoolMask) const
12664{
12665 if (meleeSchoolMask == SPELL_SCHOOL_MASK_NONE)
12666 {
12667 return false;
12668 }
12669
12670 // If m_immuneToDamage type contain magic, IMMUNE damage.
12671 SpellImmuneList const& damageList = m_spellImmune[IMMUNITY_DAMAGE];
12672 for (SpellImmuneList::const_iterator itr = damageList.begin(); itr != damageList.end(); ++itr)
12673 if((itr->type & meleeSchoolMask) == meleeSchoolMask)
12674 return true;
12675
12676 return false;
12677}

References IMMUNITY_DAMAGE, m_spellImmune, and SPELL_SCHOOL_MASK_NONE.

Referenced by Spell::DoSpellHitOnUnit(), and IsImmunedToDamageOrSchool().

◆ IsImmunedToDamageOrSchool() [1/2]

bool Unit::IsImmunedToDamageOrSchool ( SpellInfo const *  spellInfo) const
12828{
12829 return IsImmunedToDamage(spellInfo) || IsImmunedToSchool(spellInfo);
12830}
bool IsImmunedToSchool(SpellSchoolMask meleeSchoolMask) const
Definition: Unit.cpp:12748
bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask) const
Definition: Unit.cpp:12663

References IsImmunedToDamage(), and IsImmunedToSchool().

◆ IsImmunedToDamageOrSchool() [2/2]

◆ IsImmunedToSchool() [1/3]

bool Unit::IsImmunedToSchool ( Spell const *  spell) const
12788{
12789 SpellInfo const* spellInfo = spell->GetSpellInfo();
12791 {
12792 return false;
12793 }
12794
12795 uint32 schoolMask = spell->GetSpellSchoolMask();
12796 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
12797 {
12798 return false;
12799 }
12800
12801 if (spellInfo->Id != 42292 && spellInfo->Id != 59752 && spellInfo->Id != 19574 && spellInfo->Id != 34471)
12802 {
12803 // If m_immuneToSchool type contain this school type, IMMUNE damage.
12804 SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
12805 for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
12806 {
12807 if ((itr->type & schoolMask) == schoolMask && !spellInfo->CanPierceImmuneAura(sSpellMgr->GetSpellInfo(itr->spellId)))
12808 {
12809 return true;
12810 }
12811 }
12812 }
12813
12814 return false;
12815}
@ IMMUNITY_SCHOOL
Definition: SharedDefines.h:1368
bool CanPierceImmuneAura(SpellInfo const *aura) const
Definition: SpellInfo.cpp:1307

References SpellInfo::CanPierceImmuneAura(), Spell::GetSpellInfo(), Spell::GetSpellSchoolMask(), SpellInfo::HasAttribute(), HasAuraType(), SpellInfo::Id, IMMUNITY_SCHOOL, m_spellImmune, SPELL_ATTR0_NO_IMMUNITIES, SPELL_AURA_SPIRIT_OF_REDEMPTION, SPELL_SCHOOL_MASK_NONE, and sSpellMgr.

◆ IsImmunedToSchool() [2/3]

bool Unit::IsImmunedToSchool ( SpellInfo const *  spellInfo) const
12765{
12767 return false;
12768
12769 uint32 schoolMask = spellInfo->GetSchoolMask();
12770 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
12771 {
12772 return false;
12773 }
12774
12775 if (spellInfo->Id != 42292 && spellInfo->Id != 59752 && spellInfo->Id != 19574 && spellInfo->Id != 34471)
12776 {
12777 // If m_immuneToSchool type contain this school type, IMMUNE damage.
12778 SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
12779 for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
12780 if((itr->type & schoolMask) == schoolMask && !spellInfo->CanPierceImmuneAura(sSpellMgr->GetSpellInfo(itr->spellId)))
12781 return true;
12782 }
12783
12784 return false;
12785}

References SpellInfo::CanPierceImmuneAura(), SpellInfo::GetSchoolMask(), SpellInfo::HasAttribute(), HasAuraType(), SpellInfo::Id, IMMUNITY_SCHOOL, m_spellImmune, SPELL_ATTR0_NO_IMMUNITIES, SPELL_AURA_SPIRIT_OF_REDEMPTION, SPELL_SCHOOL_MASK_NONE, and sSpellMgr.

◆ IsImmunedToSchool() [3/3]

bool Unit::IsImmunedToSchool ( SpellSchoolMask  meleeSchoolMask) const
12749{
12750 if (meleeSchoolMask == SPELL_SCHOOL_MASK_NONE)
12751 {
12752 return false;
12753 }
12754
12755 // If m_immuneToSchool type contain this school type, IMMUNE damage.
12756 SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
12757 for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
12758 if((itr->type & meleeSchoolMask) == meleeSchoolMask)
12759 return true;
12760
12761 return false;
12762}

References IMMUNITY_SCHOOL, m_spellImmune, and SPELL_SCHOOL_MASK_NONE.

Referenced by Spell::DoSpellHitOnUnit(), IsImmunedToDamageOrSchool(), and SpellHitResult().

◆ IsImmunedToSpell()

bool Unit::IsImmunedToSpell ( SpellInfo const *  spellInfo,
Spell const *  spell = nullptr 
)
virtual

Reimplemented in Creature.

12833{
12834 if (!spellInfo)
12835 return false;
12836
12837 // Single spell immunity.
12838 SpellImmuneList const& idList = m_spellImmune[IMMUNITY_ID];
12839 for (SpellImmuneList::const_iterator itr = idList.begin(); itr != idList.end(); ++itr)
12840 if (itr->type == spellInfo->Id)
12841 return true;
12842
12843 // xinef: my special immunity, if spellid is not on this list it means npc is immune
12844 SpellImmuneList const& allowIdList = m_spellImmune[IMMUNITY_ALLOW_ID];
12845 if (!allowIdList.empty())
12846 {
12847 for (SpellImmuneList::const_iterator itr = allowIdList.begin(); itr != allowIdList.end(); ++itr)
12848 if (itr->type == spellInfo->Id)
12849 return false;
12850 return true;
12851 }
12852
12854 return false;
12855
12856 if (spellInfo->Dispel)
12857 {
12858 SpellImmuneList const& dispelList = m_spellImmune[IMMUNITY_DISPEL];
12859 for (SpellImmuneList::const_iterator itr = dispelList.begin(); itr != dispelList.end(); ++itr)
12860 if (itr->type == spellInfo->Dispel)
12861 return true;
12862 }
12863
12864 // Spells that don't have effectMechanics.
12865 if (spellInfo->Mechanic)
12866 {
12867 SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
12868 for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
12869 if (itr->type == spellInfo->Mechanic)
12870 return true;
12871 }
12872
12873 bool immuneToAllEffects = true;
12874 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
12875 {
12876 // State/effect immunities applied by aura expect full spell immunity
12877 // Ignore effects with mechanic, they are supposed to be checked separately
12878 if (!spellInfo->Effects[i].IsEffect())
12879 continue;
12880
12881 // Xinef: if target is immune to one effect, and the spell has transform aura - it is immune to whole spell
12882 if (IsImmunedToSpellEffect(spellInfo, i))
12883 {
12884 if (spellInfo->HasAura(SPELL_AURA_TRANSFORM))
12885 return true;
12886 continue;
12887 }
12888
12889 immuneToAllEffects = false;
12890 break;
12891 }
12892 if (immuneToAllEffects) //Return immune only if the target is immune to all spell effects.
12893 return true;
12894
12895 if (spellInfo->Id != 42292 && spellInfo->Id != 59752 && spellInfo->Id != 19574 && spellInfo->Id != 34471)
12896 {
12897 SpellSchoolMask spellSchoolMask = spellInfo->GetSchoolMask();
12898 if (spell)
12899 {
12900 spellSchoolMask = spell->GetSpellSchoolMask();
12901 }
12902
12903 if (spellSchoolMask != SPELL_SCHOOL_MASK_NONE)
12904 {
12905 SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
12906 for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
12907 {
12908 SpellInfo const* immuneSpellInfo = sSpellMgr->GetSpellInfo(itr->spellId);
12909 if (((itr->type & spellSchoolMask) == spellSchoolMask)
12910 && (!immuneSpellInfo || immuneSpellInfo->IsPositive()) && !spellInfo->IsPositive()
12911 && !spellInfo->CanPierceImmuneAura(immuneSpellInfo))
12912 {
12913 return true;
12914 }
12915 }
12916 }
12917 }
12918
12919 return false;
12920}
@ IMMUNITY_ALLOW_ID
Definition: SharedDefines.h:1373
@ IMMUNITY_ID
Definition: SharedDefines.h:1372
@ IMMUNITY_MECHANIC
Definition: SharedDefines.h:1371

References SpellInfo::CanPierceImmuneAura(), SpellInfo::Dispel, SpellInfo::Effects, SpellInfo::GetSchoolMask(), Spell::GetSpellSchoolMask(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), HasAuraType(), SpellInfo::Id, IMMUNITY_ALLOW_ID, IMMUNITY_DISPEL, IMMUNITY_ID, IMMUNITY_MECHANIC, IMMUNITY_SCHOOL, IsImmunedToSpellEffect(), SpellInfo::IsPositive(), m_spellImmune, MAX_SPELL_EFFECTS, SpellInfo::Mechanic, SPELL_ATTR0_NO_IMMUNITIES, SPELL_AURA_SPIRIT_OF_REDEMPTION, SPELL_AURA_TRANSFORM, SPELL_SCHOOL_MASK_NONE, and sSpellMgr.

Referenced by AddAura(), Spell::DoSpellHitOnUnit(), Creature::IsImmunedToSpell(), spell_hun_lock_and_load::IsTargetValid(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MySelectNextTarget(), and SpellHitResult().

◆ IsImmunedToSpellEffect()

bool Unit::IsImmunedToSpellEffect ( SpellInfo const *  spellInfo,
uint32  index 
) const
virtual

Reimplemented in Creature, and Totem.

12923{
12924 if (!spellInfo || !spellInfo->Effects[index].IsEffect())
12925 return false;
12926
12927 // xinef: pet scaling auras
12928 if (spellInfo->HasAttribute(SPELL_ATTR4_OWNER_POWER_SCALING))
12929 return false;
12930
12932 return false;
12933
12934 //If m_immuneToEffect type contain this effect type, IMMUNE effect.
12935 uint32 effect = spellInfo->Effects[index].Effect;
12936 SpellImmuneList const& effectList = m_spellImmune[IMMUNITY_EFFECT];
12937 for (SpellImmuneList::const_iterator itr = effectList.begin(); itr != effectList.end(); ++itr)
12938 {
12939 if (itr->type == effect && (itr->spellId != 62692 || (spellInfo->Effects[index].MiscValue == POWER_MANA && !CanRestoreMana(spellInfo))))
12940 {
12941 return true;
12942 }
12943 }
12944
12945 if (uint32 mechanic = spellInfo->Effects[index].Mechanic)
12946 {
12947 SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
12948 for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
12949 if (itr->type == mechanic)
12950 return true;
12951 }
12952
12953 if (uint32 aura = spellInfo->Effects[index].ApplyAuraName)
12954 {
12956 for (SpellImmuneList::const_iterator itr = list.begin(); itr != list.end(); ++itr)
12957 {
12958 if (itr->type == aura && (itr->spellId != 64848 || (spellInfo->Effects[index].MiscValue == POWER_MANA && !CanRestoreMana(spellInfo))))
12959 {
12960 if (!spellInfo->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
12961 {
12962 if (itr->blockType == SPELL_BLOCK_TYPE_ALL || spellInfo->IsPositive()) // xinef: added for pet scaling
12963 {
12964 return true;
12965 }
12966 }
12967 }
12968 }
12969
12970 if (!spellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
12971 {
12972 // Check for immune to application of harmful magical effects
12974 for (AuraEffectList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter)
12975 {
12976 if (/*(spellInfo->Dispel == DISPEL_MAGIC || spellInfo->Dispel == DISPEL_CURSE || spellInfo->Dispel == DISPEL_DISEASE) &&*/ // Magic debuff, xinef: all kinds?
12977 ((*iter)->GetMiscValue() & spellInfo->GetSchoolMask()) && // Check school
12978 !spellInfo->IsPositiveEffect(index) && // Harmful
12979 spellInfo->Effects[index].Effect != SPELL_EFFECT_PERSISTENT_AREA_AURA) // Not Persistent area auras
12980 {
12981 return true;
12982 }
12983 }
12984 }
12985 }
12986
12987 return false;
12988}
@ SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL
Definition: SpellAuraDefines.h:330
@ SPELL_BLOCK_TYPE_ALL
Definition: SpellDefines.h:156
@ SPELL_EFFECT_PERSISTENT_AREA_AURA
Definition: SharedDefines.h:777
@ SPELL_ATTR3_ALWAYS_HIT
Definition: SharedDefines.h:483
@ IMMUNITY_STATE
Definition: SharedDefines.h:1367
@ IMMUNITY_EFFECT
Definition: SharedDefines.h:1366
@ SPELL_ATTR4_OWNER_POWER_SCALING
Definition: SharedDefines.h:527
bool CanRestoreMana(SpellInfo const *spellInfo) const
Definition: Unit.cpp:21341

References CanRestoreMana(), SpellInfo::Effects, GetAuraEffectsByType(), SpellInfo::GetSchoolMask(), SpellInfo::HasAttribute(), HasAuraType(), IMMUNITY_EFFECT, IMMUNITY_MECHANIC, IMMUNITY_STATE, SpellInfo::IsPositive(), SpellInfo::IsPositiveEffect(), m_spellImmune, POWER_MANA, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR2_NO_SCHOOL_IMMUNITIES, SPELL_ATTR3_ALWAYS_HIT, SPELL_ATTR4_OWNER_POWER_SCALING, SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL, SPELL_AURA_SPIRIT_OF_REDEMPTION, SPELL_BLOCK_TYPE_ALL, and SPELL_EFFECT_PERSISTENT_AREA_AURA.

Referenced by AddAura(), Spell::AddUnitTarget(), Spell::DoSpellHitOnUnit(), spell_dk_death_grip::HandleBaseDummy(), IsImmunedToSpell(), and Creature::IsImmunedToSpellEffect().

◆ IsImmuneToAll()

◆ IsImmuneToNPC()

◆ IsImmuneToPC()

◆ isInAccessiblePlaceFor()

bool Unit::isInAccessiblePlaceFor ( Creature const *  c) const
4134{
4135 if (c->GetMapId() == 618) // Ring of Valor
4136 {
4137 // skip transport check, check for being below floor level
4138 if (this->GetPositionZ() < 28.0f)
4139 return false;
4140 if (BattlegroundMap* bgMap = c->GetMap()->ToBattlegroundMap())
4141 if (Battleground* bg = bgMap->GetBG())
4142 if (bg->GetStartTime() < 80133) // 60000ms preparation time + 20133ms elevator rise time
4143 return false;
4144 }
4145 else if (c->GetMapId() == 631) // Icecrown Citadel
4146 {
4147 // if static transport doesn't match - return false
4148 if (c->GetTransport() != this->GetTransport() && ((c->GetTransport() && c->GetTransport()->IsStaticTransport()) || (this->GetTransport() && this->GetTransport()->IsStaticTransport())))
4149 return false;
4150
4151 // special handling for ICC (map 631), for non-flying pets in Gunship Battle, for trash npcs this is done via CanAIAttack
4152 if (c->GetOwnerGUID().IsPlayer() && !c->CanFly())
4153 {
4154 if (c->GetTransport() != this->GetTransport())
4155 return false;
4156 if (this->GetTransport())
4157 {
4158 if (c->GetPositionY() < 2033.0f)
4159 {
4160 if (this->GetPositionY() > 2033.0f)
4161 return false;
4162 }
4163 else if (c->GetPositionY() < 2438.0f)
4164 {
4165 if (this->GetPositionY() < 2033.0f || this->GetPositionY() > 2438.0f)
4166 return false;
4167 }
4168 else if (this->GetPositionY() < 2438.0f)
4169 return false;
4170 }
4171 }
4172 }
4173 else
4174 {
4175 // pussywizard: prevent any bugs by passengers exiting transports or normal creatures flying away
4176 if (c->GetTransport() != this->GetTransport())
4177 return false;
4178 }
4179
4180 LiquidStatus liquidStatus = GetLiquidData().Status;
4181 bool isInWater = (liquidStatus & MAP_LIQUID_STATUS_IN_CONTACT) != 0;
4182
4183 // In water or jumping in water
4184 if (isInWater || (liquidStatus == LIQUID_MAP_ABOVE_WATER && (IsFalling() || (ToPlayer() && ToPlayer()->IsFalling()))))
4185 {
4186 return c->CanEnterWater();
4187 }
4188 else
4189 {
4190 return c->CanWalk() || c->CanFly();
4191 }
4192}
LiquidStatus
Definition: Map.h:142
@ LIQUID_MAP_ABOVE_WATER
Definition: Map.h:144
#define MAP_LIQUID_STATUS_IN_CONTACT
Definition: Map.h:151
LiquidData const & GetLiquidData() const
Definition: Object.cpp:3108
bool IsFalling() const
Definition: Unit.cpp:20079
LiquidStatus Status
Definition: Map.h:177
BattlegroundMap * ToBattlegroundMap()
Definition: Map.h:547
Definition: Map.h:847

References Creature::CanEnterWater(), Creature::CanFly(), Creature::CanWalk(), WorldObject::GetLiquidData(), WorldObject::GetMap(), WorldLocation::GetMapId(), GetOwnerGUID(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::GetTransport(), IsFalling(), ObjectGuid::IsPlayer(), GameObject::IsStaticTransport(), LIQUID_MAP_ABOVE_WATER, MAP_LIQUID_STATUS_IN_CONTACT, LiquidData::Status, Map::ToBattlegroundMap(), and Object::ToPlayer().

Referenced by npc_escortAI::AssistPlayerInCombatAgainst(), Creature::CanCreatureAttack(), ChaseMovementGenerator< T >::DoUpdate(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), npc_pet_hunter_snake_trap::MoveInLineOfSight(), and HostileReference::updateOnlineStatus().

◆ isInBackInMap()

bool Unit::isInBackInMap ( Unit const *  target,
float  distance,
float  arc = M_PI 
) const

◆ IsInCombat()

bool Unit::IsInCombat ( ) const
inline

References HasUnitFlag(), and UNIT_FLAG_IN_COMBAT.

Referenced by _IsValidAttackTarget(), Player::ActivateTaxiPathTo(), npc_anubisath_sentinel::aqsentinelAI::CallBuddiesToAttack(), npc_argent_captainAI::CanAIAttack(), Player::CanEquipItem(), Creature::CanPeriodicallyCallForAssistance(), Player::CanUnequipItem(), spell_hun_disengage::CheckCast(), Spell::CheckCast(), boss_kelidan_the_breaker::boss_kelidan_the_breakerAI::CheckChannelers(), SpellInfo::CheckTarget(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::CheckTombReset(), CombatStart(), npc_centrifuge_construct::npc_centrifuge_constructAI::DamageTaken(), npc_boss_gothik_minion::npc_boss_gothik_minionAI::DamageTaken(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DoAction(), boss_the_lich_king::boss_the_lich_kingAI::DoAction(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::DoAction(), npc_risen_archmage::npc_risen_archmageAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::DoAction(), boss_kelidan_the_breaker::boss_kelidan_the_breakerAI::DoAction(), UnitAI::DoAddAuraToAllHostilePlayers(), Spell::DoAllEffectOnTarget(), UnitAI::DoCastToAllHostilePlayers(), Spell::DoSpellHitOnUnit(), Spell::EffectActivateRune(), npc_clintar_spirit::npc_clintar_spiritAI::EnterEvadeMode(), boss_professor_putricide::boss_professor_putricideAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), Player::EquipItem(), CastRunesEvent::Execute(), GetVelocity(), spell_apothecary_lingering_fumes::HandleAfterCast(), WorldSession::HandleBattlefieldLeaveOpcode(), WorldSession::HandleBattleFieldPortOpcode(), spell_mc_play_dead::spell_mc_play_dead_AuraScript::HandleEffectRemove(), WorldSession::HandleEquipmentSetUse(), WorldSession::HandleGossipHelloOpcode(), boss_malygos::boss_malygosAI::HandleIntroSpeech(), WorldSession::HandleLogoutRequestOpcode(), WorldSession::HandleMessagechatOpcode(), WorldSession::HandlePetCastSpellOpcode(), WorldSession::HandleSetRaidDifficultyOpcode(), ArenaSpectator::HandleSpectatorSpectateCommand(), spell_putricide_mutated_transformation::spell_putricide_mutated_transformation_SpellScript::HandleSummon(), WorldSession::HandleSummonResponseOpcode(), tele_commandscript::HandleTeleCommand(), misc_commandscript::HandleUnstuckCommand(), WorldSession::HandleUseItemOpcode(), npc_pet_mage_mirror_image::InitializeAI(), IsEngaged(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_anubrekhan::boss_anubrekhanAI::JustSummoned(), boss_kelthuzad::boss_kelthuzadAI::JustSummoned(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), boss_rotface::boss_rotfaceAI::JustSummoned(), boss_nexusprince_shaffar::boss_nexusprince_shaffarAI::JustSummoned(), npc_nelson::npc_nelsonAI::JustSummoned(), Pet::LoseHappiness(), CreatureGroup::MemberEvaded(), CreatureAI::MoveInLineOfSight(), npc_shay_leafrunner::npc_shay_leafrunnerAI::MoveInLineOfSight(), npc_towering_infernal::npc_towering_infernalAI::MoveInLineOfSight(), npc_lesser_doomguard::npc_lesser_doomguardAI::MoveInLineOfSight(), boss_eye_of_cthun::MoveInLineOfSight(), boss_anubarak_trial::boss_anubarak_trialAI::MoveInLineOfSight(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::MoveInLineOfSight(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::MoveInLineOfSight(), boss_kelthuzad::boss_kelthuzadAI::MoveInLineOfSight(), boss_razorscale::boss_razorscaleAI::MovementInform(), boss_alar::boss_alarAI::MovementInform(), npc_zelfrax::npc_zelfraxAI::MovementInform(), npc_pet_mage_mirror_image::MySelectNextTarget(), npc_death_knight_initiate::OnGossipHello(), npc_ulduar_expedition_commander::OnGossipHello(), go_prince_taldaram_sphere::OnGossipHello(), go_ulduar_working_harpoon::OnGossipHello(), npc_death_knight_initiate::OnGossipSelect(), npc_ulduar_expedition_commander::OnGossipSelect(), icecrown_citadel_teleport::OnGossipSelect(), at_frozen_throne_teleport::OnTrigger(), at_naxxramas_hub_portal::OnTrigger(), AreaTrigger_at_voltarus_middle::OnTrigger(), AreaTrigger_at_legion_teleporter::OnTrigger(), RisenArchmageCheck::operator()(), Acore::MostHPMissingInRange::operator()(), Acore::MostHPPercentMissingInRange::operator()(), Acore::FriendlyCCedInRange::operator()(), Acore::FriendlyMissingBuffInRange::operator()(), Acore::AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck::operator()(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::OwnerAttackedBy(), boss_kologarn::boss_kologarnAI::PassengerBoarded(), SmartScript::ProcessEvent(), Creature::Regenerate(), Player::Regenerate(), Player::RegenerateAll(), Player::RegenerateHealth(), boss_gluth::boss_gluthAI::SelectPlayerInRoom(), instance_naxxramas::instance_naxxramas_InstanceMapScript::SetBossState(), SetInCombatState(), SetSpeed(), boss_prince_keleseth_icc::boss_prince_kelesethAI::SpellHit(), boss_prince_taldaram_icc::boss_prince_taldaramAI::SpellHit(), boss_prince_valanar_icc::boss_prince_valanarAI::SpellHit(), boss_the_lich_king::boss_the_lich_kingAI::SpellHit(), Spell::SummonGuardian(), lfg::LFGMgr::TeleportPlayer(), Map::Update(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), Creature::Update(), TempSummon::Update(), Update(), DistractMovementGenerator::Update(), TotemAI::UpdateAI(), SimpleCharmedAI::UpdateAI(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_scarlet_courier::npc_scarlet_courierAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_yenniku::npc_yennikuAI::UpdateAI(), boss_archimonde::boss_archimondeAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI(), boss_faction_championsAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::UpdateAI(), npc_risen_archmage::npc_risen_archmageAI::UpdateAI(), npc_frost_freeze_trap::npc_frost_freeze_trapAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), boss_anubrekhan::boss_anubrekhanAI::UpdateAI(), boss_faerlina::boss_faerlinaAI::UpdateAI(), boss_grobbulus::boss_grobbulusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_hodir::boss_hodirAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_ulduar_expedition_engineer::npc_ulduar_expedition_engineerAI::UpdateAI(), npc_llod_generic::npc_llod_genericAI::UpdateAI(), npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI(), boss_ahune::boss_ahuneAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), npc_pet_shaman_earth_elemental::UpdateAI(), npc_pet_shaman_fire_elemental::UpdateAI(), boss_taerar::boss_taerarAI::UpdateAI(), generic_creature::generic_creatureAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), PassiveAI::UpdateAI(), PetAI::UpdateAI(), Player::UpdateContestedPvP(), Creature::UpdateEntry(), boss_bjarngrim::boss_bjarngrimAI::UpdateEscortAI(), InstanceScript::UpdateMinionState(), SmartAI::UpdatePath(), Player::UpdatePotionCooldown(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ IsInCombatWith()

bool Unit::IsInCombatWith ( Unit const *  who) const
21164{
21165 // Check target exists
21166 if (!who)
21167 return false;
21168 // Search in threat list
21169 ObjectGuid guid = who->GetGUID();
21170 for (ThreatContainer::StorageType::const_iterator i = m_ThreatMgr.GetThreatList().begin(); i != m_ThreatMgr.GetThreatList().end(); ++i)
21171 {
21172 HostileReference* ref = (*i);
21173 // Return true if the unit matches
21174 if (ref && ref->getUnitGuid() == guid)
21175 return true;
21176 }
21177 // Nothing found, false.
21178 return false;
21179}
Definition: ThreatMgr.h:49
ObjectGuid getUnitGuid() const
Definition: ThreatMgr.h:107
ThreatContainer::StorageType const & GetThreatList() const
Definition: ThreatMgr.h:274

References Object::GetGUID(), ThreatMgr::GetThreatList(), HostileReference::getUnitGuid(), and m_ThreatMgr.

Referenced by _IsValidAttackTarget(), DealDamage(), Spell::DoAllEffectOnTarget(), TemporaryThreatModifierEvent::Execute(), spell_herald_volzaj_insanity::HandleDummyEffect(), IsEngagedBy(), and Acore::NearestAttackableUnitInObjectRangeCheck::operator()().

◆ IsInDisallowedMountForm()

bool Unit::IsInDisallowedMountForm ( ) const
21366{
21367 if (SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(getTransForm()))
21368 {
21369 if (transformSpellInfo->HasAttribute(SPELL_ATTR0_ALLOW_WHILE_MOUNTED))
21370 {
21371 return false;
21372 }
21373 }
21374
21375 if (ShapeshiftForm form = GetShapeshiftForm())
21376 {
21377 SpellShapeshiftEntry const* shapeshift = sSpellShapeshiftStore.LookupEntry(form);
21378 if (!shapeshift)
21379 {
21380 return true;
21381 }
21382
21383 if (!(shapeshift->flags1 & 0x1))
21384 {
21385 return true;
21386 }
21387 }
21388
21390 {
21391 return false;
21392 }
21393
21394 CreatureDisplayInfoEntry const* display = sCreatureDisplayInfoStore.LookupEntry(GetDisplayId());
21395 if (!display)
21396 {
21397 return true;
21398 }
21399
21401 if (!displayExtra)
21402 {
21403 return true;
21404 }
21405
21406 CreatureModelDataEntry const* model = sCreatureModelDataStore.LookupEntry(display->ModelId);
21407 ChrRacesEntry const* race = sChrRacesStore.LookupEntry(displayExtra->DisplayRaceID);
21408
21409 if (model && !(model->HasFlag(CREATURE_MODEL_DATA_FLAGS_CAN_MOUNT)))
21410 {
21411 if (race && !(race->HasFlag(CHRRACES_FLAGS_CAN_MOUNT)))
21412 {
21413 return true;
21414 }
21415 }
21416
21417 return false;
21418}
DBCStorage< CreatureDisplayInfoExtraEntry > sCreatureDisplayInfoExtraStore(CreatureDisplayInfoExtrafmt)
@ CHRRACES_FLAGS_CAN_MOUNT
Definition: DBCStructure.h:675
@ CREATURE_MODEL_DATA_FLAGS_CAN_MOUNT
Definition: DBCStructure.h:771
@ SPELL_ATTR0_ALLOW_WHILE_MOUNTED
Definition: SharedDefines.h:378
uint32 GetDisplayId() const
Definition: Unit.h:2168
bool HasFlag(ChrRacesFlags flag) const
Definition: DBCStructure.h:700
uint32 ExtendedDisplayInfoID
Definition: DBCStructure.h:725
Definition: DBCStructure.h:739
uint32 DisplayRaceID
Definition: DBCStructure.h:741
bool HasFlag(CreatureModelDataFlags flag) const
Definition: DBCStructure.h:795
uint32 flags1
Definition: DBCStructure.h:1783

References CHRRACES_FLAGS_CAN_MOUNT, CREATURE_MODEL_DATA_FLAGS_CAN_MOUNT, CreatureDisplayInfoExtraEntry::DisplayRaceID, CreatureDisplayInfoEntry::ExtendedDisplayInfoID, SpellShapeshiftEntry::flags1, GetDisplayId(), GetNativeDisplayId(), GetShapeshiftForm(), getTransForm(), ChrRacesEntry::HasFlag(), CreatureModelDataEntry::HasFlag(), CreatureDisplayInfoEntry::ModelId, sChrRacesStore, sCreatureDisplayInfoExtraStore, sCreatureDisplayInfoStore, sCreatureModelDataStore, SPELL_ATTR0_ALLOW_WHILE_MOUNTED, sSpellMgr, and sSpellShapeshiftStore.

Referenced by Player::ActivateTaxiPathTo(), Spell::CheckCast(), Player::ContinueTaxiFlight(), and Player::ProcessDelayedOperations().

◆ IsInFeralForm()

bool Unit::IsInFeralForm ( ) const
inline

◆ IsInFlight()

bool Unit::IsInFlight ( ) const
inline

◆ isInFrontInMap()

bool Unit::isInFrontInMap ( Unit const *  target,
float  distance,
float  arc = M_PI 
) const
4124{
4125 return IsWithinDistInMap(target, distance) && HasInArc(arc, target);
4126}

References Position::HasInArc(), and WorldObject::IsWithinDistInMap().

◆ IsInnkeeper()

bool Unit::IsInnkeeper ( ) const
inline
@ UNIT_NPC_FLAG_INNKEEPER
Definition: Unit.h:532

References HasNpcFlag(), and UNIT_NPC_FLAG_INNKEEPER.

Referenced by npc_innkeeper::OnGossipHello().

◆ IsInPartyWith()

bool Unit::IsInPartyWith ( Unit const *  unit) const
18913{
18914 if (this == unit)
18915 return true;
18916
18917 Unit const* u1 = GetCharmerOrOwnerOrSelf();
18918 Unit const* u2 = unit->GetCharmerOrOwnerOrSelf();
18919 if (u1 == u2)
18920 return true;
18921
18922 if (u1->GetTypeId() == TYPEID_PLAYER && u2->GetTypeId() == TYPEID_PLAYER)
18923 return u1->ToPlayer()->IsInSameGroupWith(u2->ToPlayer());
18924 // Xinef: we assume that npcs with the same faction are in party
18925 else if (u1->GetTypeId() == TYPEID_UNIT && u2->GetTypeId() == TYPEID_UNIT && !u1->IsControlledByPlayer() && !u2->IsControlledByPlayer())
18926 return u1->GetFaction() == u2->GetFaction();
18927 // Xinef: creature type_flag should work for party check only if player group is not a raid
18930 return true;
18931 else
18932 return false;
18933}
bool IsInSameGroupWith(Player const *p) const
Definition: Player.cpp:2280
bool isRaidGroup() const
Definition: Group.cpp:2210

References CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, GetCharmerOrOwnerOrSelf(), Creature::GetCreatureTemplate(), GetFaction(), Player::GetGroup(), Object::GetTypeId(), IsControlledByPlayer(), Player::IsInSameGroupWith(), Group::isRaidGroup(), Object::ToCreature(), Object::ToPlayer(), CreatureTemplate::type_flags, TYPEID_PLAYER, and TYPEID_UNIT.

Referenced by SpellInfo::CheckExplicitTarget(), SpellClickInfo::IsFitToRequirements(), Condition::Meets(), Acore::AnyGroupedUnitInObjectRangeCheck::operator()(), and Acore::WorldObjectSpellTargetCheck::operator()().

◆ IsInRaidWith()

bool Unit::IsInRaidWith ( Unit const *  unit) const
18936{
18937 if (this == unit)
18938 return true;
18939
18940 Unit const* u1 = GetCharmerOrOwnerOrSelf();
18941 Unit const* u2 = unit->GetCharmerOrOwnerOrSelf();
18942 if (u1 == u2)
18943 return true;
18944
18945 if (u1->GetTypeId() == TYPEID_PLAYER && u2->GetTypeId() == TYPEID_PLAYER)
18946 return u1->ToPlayer()->IsInSameRaidWith(u2->ToPlayer());
18947 // Xinef: we assume that npcs with the same faction are in party
18948 else if (u1->GetTypeId() == TYPEID_UNIT && u2->GetTypeId() == TYPEID_UNIT && !u1->IsControlledByPlayer() && !u2->IsControlledByPlayer())
18949 return u1->GetFaction() == u2->GetFaction();
18952 return true;
18953 else
18954 return false;
18955}

References CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, GetCharmerOrOwnerOrSelf(), Creature::GetCreatureTemplate(), GetFaction(), Object::GetTypeId(), IsControlledByPlayer(), Player::IsInSameRaidWith(), Object::ToCreature(), Object::ToPlayer(), CreatureTemplate::type_flags, TYPEID_PLAYER, and TYPEID_UNIT.

Referenced by Corpse::BuildValuesUpdate(), BuildValuesUpdate(), SpellInfo::CheckExplicitTarget(), GetReactionTo(), WorldSession::HandleLootMasterGiveOpcode(), SpellClickInfo::IsFitToRequirements(), Condition::Meets(), Acore::AnyGroupedUnitInObjectRangeCheck::operator()(), and Acore::WorldObjectSpellTargetCheck::operator()().

◆ isInRoots()

bool Unit::isInRoots ( ) const
inline

◆ IsInSanctuary()

◆ IsInWater()

bool Unit::IsInWater ( ) const
virtual

Reimplemented in Player.

4280{
4281 return (GetLiquidData().Status & MAP_LIQUID_STATUS_SWIMMING) != 0;
4282}
#define MAP_LIQUID_STATUS_SWIMMING
Definition: Map.h:150

References WorldObject::GetLiquidData(), and MAP_LIQUID_STATUS_SWIMMING.

Referenced by Spell::CheckCast(), WorldObject::GetNearPoint(), Totem::InitSummon(), and Spell::SelectImplicitCasterDestTargets().

◆ IsLevitating()

◆ IsMounted()

◆ IsMovementPreventedByCasting()

bool Unit::IsMovementPreventedByCasting ( ) const
virtual

Reimplemented in Creature.

4100{
4101 // can always move when not casting
4103 {
4104 return false;
4105 }
4106
4107 // channeled spells during channel stage (after the initial cast timer) allow movement with a specific spell attribute
4109 {
4110 if (spell->getState() != SPELL_STATE_FINISHED && spell->IsChannelActive())
4111 {
4112 if (spell->GetSpellInfo()->IsActionAllowedChannel())
4113 {
4114 return false;
4115 }
4116 }
4117 }
4118
4119 // prohibit movement for all other spell casts
4120 return true;
4121}
@ UNIT_STATE_CASTING
Definition: Unit.h:340

References CURRENT_CHANNELED_SPELL, HasUnitState(), m_currentSpells, SPELL_STATE_FINISHED, and UNIT_STATE_CASTING.

Referenced by TimedFleeingMovementGenerator::Update().

◆ isMoving()

◆ IsNeutralToAll()

bool Unit::IsNeutralToAll ( ) const
10233{
10234 FactionTemplateEntry const* my_faction = GetFactionTemplateEntry();
10235 if (!my_faction || !my_faction->faction)
10236 return true;
10237
10238 FactionEntry const* raw_faction = sFactionStore.LookupEntry(my_faction->faction);
10239 if (raw_faction && raw_faction->reputationListID >= 0)
10240 return false;
10241
10242 return my_faction->IsNeutralToAll();
10243}
bool IsNeutralToAll() const
Definition: DBCStructure.h:973

References FactionTemplateEntry::faction, GetFactionTemplateEntry(), FactionTemplateEntry::IsNeutralToAll(), FactionEntry::reputationListID, and sFactionStore.

Referenced by Creature::_IsTargetAcceptable(), Creature::CanStartAttack(), AggressorAI::Permissible(), and ReactorAI::Permissible().

◆ IsNonMeleeSpellCast()

bool Unit::IsNonMeleeSpellCast ( bool  withDelayed,
bool  skipChanneled = false,
bool  skipAutorepeat = false,
bool  isAutoshoot = false,
bool  skipInstant = true 
) const
4040{
4041 // We don't do loop here to explicitly show that melee spell is excluded.
4042 // Maybe later some special spells will be excluded too.
4043
4044 // generic spells are cast when they are not finished and not delayed
4047 (withDelayed || m_currentSpells[CURRENT_GENERIC_SPELL]->getState() != SPELL_STATE_DELAYED))
4048 {
4049 if (!skipInstant || m_currentSpells[CURRENT_GENERIC_SPELL]->GetCastTime())
4050 {
4051 if (!isAutoshoot || !m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS))
4052 return true;
4053 }
4054 }
4055 // channeled spells may be delayed, but they are still considered cast
4056 if (!skipChanneled && m_currentSpells[CURRENT_CHANNELED_SPELL] &&
4058 {
4059 if (!isAutoshoot || !m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS))
4060 return true;
4061 }
4062 // autorepeat spells may be finished or delayed, but they are still considered cast
4063 if (!skipAutorepeat && m_currentSpells[CURRENT_AUTOREPEAT_SPELL])
4064 return true;
4065
4066 return false;
4067}
@ SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS
Definition: SharedDefines.h:445

References CURRENT_AUTOREPEAT_SPELL, CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, m_currentSpells, SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS, SPELL_STATE_DELAYED, and SPELL_STATE_FINISHED.

Referenced by Spell::_cast(), _UpdateAutoRepeatSpell(), Player::ActivateSpec(), Player::ActivateTaxiPathTo(), Player::CanEquipItem(), CombatStop(), npc_mograine::npc_mograineAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), ScriptedAI::DoCastSpell(), boss_zuljin::boss_zuljinAI::DoMeleeAttackIfReady(), Spell::EffectKnockBack(), Spell::finish(), WorldSession::HandleCancelCastOpcode(), WorldSession::HandleSetRaidDifficultyOpcode(), isSpellBlocked(), MeleeSpellHitResult(), Spell::prepare(), SmartScript::ProcessEvent(), RollMeleeOutcomeAgainst(), spell_item_fetch_ball::SelectTarget(), setDeathState(), boss_shade_of_aran::boss_aranAI::SpellHit(), StopAttackFaction(), Player::TeleportTo(), TotemAI::UpdateAI(), boss_netherspite::boss_netherspiteAI::UpdateAI(), boss_shade_of_aran::boss_aranAI::UpdateAI(), boss_high_inquisitor_whitemane::boss_high_inquisitor_whitemaneAI::UpdateAI(), boss_janalai::boss_janalaiAI::UpdateAI(), hyjalAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::UpdateAI(), npc_vh_teleportation_portal::npc_vh_teleportation_portalAI::UpdateAI(), boss_pandemonius::boss_pandemoniusAI::UpdateAI(), generic_creature::generic_creatureAI::UpdateAI(), npc_warmage_violetstand::UpdateAI(), and npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::UpdateAI().

◆ IsOnVehicle()

◆ IsPet()

bool Unit::IsPet ( ) const
inline
1413{ return m_unitTypeMask & UNIT_MASK_PET; }
@ UNIT_MASK_PET
Definition: Unit.h:679

References m_unitTypeMask, and UNIT_MASK_PET.

Referenced by Spell::_cast(), Spell::AddUnitTarget(), Creature::AllLootRemovedFromCorpse(), BeforeVisibilityDestroy< Creature >(), Creature::CallAssistance(), Creature::CallForHelp(), boss_renataki::boss_renatakiAI::CanAlwaysBeDetectable(), boss_renataki::boss_renatakiAI::CanSeeAlways(), Creature::CanSwim(), ClearInCombat(), CombatStart(), Creature::CreateFromProto(), Player::CreatePet(), hyjal_trashAI::DamageTaken(), npc_calvin_montague::npc_calvin_montagueAI::DamageTaken(), DealDamage(), MotionTransport::DelayedTeleportTransport(), PetAI::DoAttack(), ChaseMovementGenerator< T >::DoUpdate(), Spell::EffectDismissPet(), Spell::EffectForceDeselect(), Spell::EffectRenamePet(), Spell::EffectSanctuary(), Spell::EffectSchoolDMG(), Spell::EffectTameCreature(), npc_hivezara_stinger::EnterCombat(), npc_vekniss_stinger::EnterCombat(), Acore::XP::Gain(), Creature::GetAggroRange(), GetCastingTimeForBonus(), GetCombatRatingReduction(), GetCreatePowers(), GetNextRandomRaidMemberOrPet(), GetRandomContactPoint(), GetVelocity(), AuraEffect::HandleAuraModResistance(), AuraEffect::HandleAuraModStat(), debug_commandscript::HandleDebugThreatListCommand(), AuraEffect::HandleFeignDeath(), modify_commandscript::HandleModifyTalentCommand(), AuraEffect::HandleModPossessPet(), AuraEffect::HandleModResistancePercent(), AuraEffect::HandleModTotalPercentStat(), npc_commandscript::HandleNpcDeleteCommand(), npc_commandscript::HandleNpcSetLevelCommand(), npc_commandscript::HandleNpcSetModelCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetPhaseCommand(), npc_commandscript::HandleNpcTameCommand(), WorldSession::HandlePetAbandon(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePetCastSpellOpcode(), pet_commandscript::HandlePetCreateCommand(), WorldSession::HandlePetRename(), WorldSession::HandlePetSetAction(), HandleProcTriggerSpell(), reset_commandscript::HandleResetTalentsCommand(), misc_commandscript::HandleRespawnCommand(), Creature::InitEntry(), TempSummon::InitStats(), Guardian::InitStatsForLevel(), DisableMgr::IsDisabledFor(), Creature::isElite(), Minion::IsGuardianPet(), Player::isHonorOrXPTarget(), Creature::isWorldBoss(), npc_webbed_creature::npc_webbed_creatureAI::JustDied(), Kill(), ModSpellCastTime(), CreatureAI::MoveBackwardsChecks(), CreatureAI::MoveCircleChecks(), npc_cos_stratholme_citizien::npc_cos_stratholme_citizienAI::MoveInLineOfSight(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::MoveInLineOfSight(), Acore::MostHPMissingGroupInRange::operator()(), PetAI::ReceiveEmote(), RollMeleeOutcomeAgainst(), FactorySelector::SelectAI(), Creature::SelectLevel(), WorldSession::SendPetNameQuery(), Spell::SendSpellGo(), Spell::SendSpellStart(), SetCharm(), Creature::SetDisplayId(), SetInCombatState(), SetMinion(), Creature::SetObjectScale(), setPowerType(), SpellDamageBonusDone(), SpellPctDamageModsDone(), ToPet(), TempSummon::UnSummon(), Update(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_hazzarah::UpdateAI(), PetAI::UpdateAI(), Player::UpdateAreaDependentAuras(), UpdateAuraForGroup(), Creature::UpdateEntry(), Creature::UpdateMoveInLineOfSightState(), and UpdateSpeed().

◆ IsPetAura()

bool Unit::IsPetAura ( Aura const *  aura)
17471{
17472 Unit* owner = GetOwner();
17473
17474 if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
17475 return false;
17476
17477 // if the owner has that pet aura, return true
17478 for (PetAura const* petAura : owner->m_petAuras)
17479 if (petAura->GetAura(GetEntry()) == aura->GetId())
17480 return true;
17481
17482 return false;
17483}
Definition: SpellMgr.h:463
uint32 GetAura(uint32 petEntry) const
Definition: SpellMgr.h:479

References PetAura::GetAura(), Object::GetEntry(), Aura::GetId(), GetOwner(), Object::GetTypeId(), m_petAuras, and TYPEID_PLAYER.

Referenced by Pet::_SaveAuras(), and Spell::EffectSummonPet().

◆ IsPetInCombat()

bool Unit::IsPetInCombat ( ) const
inline

◆ IsPolymorphed()

bool Unit::IsPolymorphed ( ) const
16890{
16891 uint32 transformId = getTransForm();
16892 if (!transformId)
16893 return false;
16894
16895 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(transformId);
16896 if (!spellInfo)
16897 return false;
16898
16899 return spellInfo->GetSpellSpecific() == SPELL_SPECIFIC_MAGE_POLYMORPH;
16900}
@ SPELL_SPECIFIC_MAGE_POLYMORPH
Definition: SpellInfo.h:160
SpellSpecificType GetSpellSpecific() const
Definition: SpellInfo.cpp:2120

References SpellInfo::GetSpellSpecific(), getTransForm(), SPELL_SPECIFIC_MAGE_POLYMORPH, and sSpellMgr.

Referenced by Attack(), AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraTransform(), Player::RegenerateAll(), Creature::RegenerateHealth(), Player::RegenerateHealth(), and Creature::Update().

◆ isPossessed()

◆ isPossessedByPlayer()

bool Unit::isPossessedByPlayer ( ) const
inline

◆ isPossessing() [1/2]

bool Unit::isPossessing ( ) const
inline
1875 {
1876 if (Unit* u = GetCharm())
1877 return u->isPossessed();
1878 else
1879 return false;
1880 }

References GetCharm().

Referenced by WorldSession::HandleCastSpellOpcode(), and misc_commandscript::HandleUnbindSightCommand().

◆ isPossessing() [2/2]

bool Unit::isPossessing ( Unit u) const
inline
1881{ return u->isPossessed() && GetCharmGUID() == u->GetGUID(); }
bool isPossessed() const
Definition: Unit.h:1872

References GetCharmGUID(), Object::GetGUID(), and isPossessed().

◆ IsPvP()

◆ IsQuestGiver()

bool Unit::IsQuestGiver ( ) const
inline
@ UNIT_NPC_FLAG_QUESTGIVER
Definition: Unit.h:517

References HasNpcFlag(), and UNIT_NPC_FLAG_QUESTGIVER.

Referenced by npc_riggle_bassbait::npc_riggle_bassbaitAI::CheckTournamentState(), npc_lokhtos_darkbargainer::OnGossipHello(), npc_highlord_darion_mograine::OnGossipHello(), npc_augustus_the_touched::OnGossipHello(), npc_parqual_fintallas::OnGossipHello(), npc_varian_wrynn::OnGossipHello(), npc_thrall_bfu::OnGossipHello(), npc_cos_chromie_middle::OnGossipHello(), npcs_riverbreeze_and_silversky::OnGossipHello(), npc_thrall_warchief::OnGossipHello(), npc_braug_dimspirit::OnGossipHello(), npc_steward_of_time::OnGossipHello(), npc_stone_watcher_of_norgannon::OnGossipHello(), npc_rivern_frostwind::OnGossipHello(), npc_fos_leader::OnGossipHello(), npc_hor_leader::OnGossipHello(), npc_oculus_drakegiver::OnGossipHello(), npc_shandy_dalaran::OnGossipHello(), npc_razael_and_lyana::OnGossipHello(), npc_mcmanus::OnGossipHello(), npc_vekjik::OnGossipHello(), npc_avatar_of_freya::OnGossipHello(), npc_roxi_ramrocket::OnGossipHello(), npc_wg_demolisher_engineer::OnGossipHello(), npc_wg_spirit_guide::OnGossipHello(), npc_wg_queue::OnGossipHello(), npc_wg_quest_giver::OnGossipHello(), npc_finklestein::OnGossipHello(), npc_captain_saeed::OnGossipHello(), npc_professor_dabiri::OnGossipHello(), npc_salsalabim::OnGossipHello(), npc_ishanah::OnGossipHello(), npc_timothy_daniels::OnGossipHello(), npc_innkeeper::OnGossipHello(), npc_prof_alchemy::OnGossipHello(), npc_prof_blacksmith::OnGossipHello(), npc_prof_leather::OnGossipHello(), npc_prof_tailor::OnGossipHello(), npc_taxi::OnGossipHello(), npc_riggle_bassbait::OnGossipHello(), and npc_sayge::OnGossipHello().

◆ IsScriptOverriden()

AuraEffect * Unit::IsScriptOverriden ( SpellInfo const *  spell,
int32  script 
) const
5722{
5724 for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
5725 {
5726 if ((*i)->GetMiscValue() == script)
5727 if ((*i)->IsAffectedOnSpell(spell))
5728 return (*i);
5729 }
5730 return nullptr;
5731}
@ SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
Definition: SpellAuraDefines.h:175

References GetAuraEffectsByType(), and SPELL_AURA_OVERRIDE_CLASS_SCRIPTS.

Referenced by Spell::CheckCast(), Spell::EffectWeaponDmg(), and AuraEffect::HandleAuraModShapeshift().

◆ IsServiceProvider()

◆ IsSitState()

bool Unit::IsSitState ( ) const
16860{
16861 uint8 s = getStandState();
16862 return
16866}
@ UNIT_STAND_STATE_SIT_HIGH_CHAIR
Definition: Unit.h:59
@ UNIT_STAND_STATE_SIT_MEDIUM_CHAIR
Definition: Unit.h:58
@ UNIT_STAND_STATE_SIT_LOW_CHAIR
Definition: Unit.h:57
@ UNIT_STAND_STATE_SIT_CHAIR
Definition: Unit.h:55

References getStandState(), UNIT_STAND_STATE_SIT, UNIT_STAND_STATE_SIT_CHAIR, UNIT_STAND_STATE_SIT_HIGH_CHAIR, UNIT_STAND_STATE_SIT_LOW_CHAIR, and UNIT_STAND_STATE_SIT_MEDIUM_CHAIR.

Referenced by _ApplyAura(), AttackerStateUpdate(), WorldSession::HandleMovementOpcodes(), IsStandState(), Spell::prepare(), and SpellTakenCritChance().

◆ isSpellBlocked()

bool Unit::isSpellBlocked ( Unit victim,
SpellInfo const *  spellProto,
WeaponAttackType  attackType = BASE_ATTACK 
)
3055{
3056 // These spells can't be blocked
3057 if (spellProto && spellProto->HasAttribute(SPELL_ATTR0_NO_ACTIVE_DEFENSE))
3058 return false;
3059
3060 if (victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION) || victim->HasInArc(M_PI, this))
3061 {
3062 // Check creatures flags_extra for disable block
3063 if (victim->GetTypeId() == TYPEID_UNIT &&
3065 return false;
3066
3067 float blockChance = victim->GetUnitBlockChance();
3068 blockChance += (int32(GetWeaponSkillValue(attackType)) - int32(victim->GetMaxSkillValueForLevel())) * 0.04f;
3069
3070 // xinef: cant block while casting or while stunned
3071 if (blockChance < 0.0f || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3072 blockChance = 0.0f;
3073
3074 if (roll_chance_f(blockChance))
3075 return true;
3076 }
3077 return false;
3078}
@ CREATURE_FLAG_EXTRA_NO_BLOCK
Definition: CreatureData.h:53
@ UNIT_STATE_CONTROLLED
Definition: Unit.h:365
@ SPELL_AURA_IGNORE_HIT_DIRECTION
Definition: SpellAuraDefines.h:351
@ SPELL_ATTR0_NO_ACTIVE_DEFENSE
Definition: SharedDefines.h:375
uint32 GetWeaponSkillValue(WeaponAttackType attType, Unit const *target=nullptr) const
Definition: Unit.cpp:3743
float GetUnitBlockChance() const
Definition: Unit.cpp:3655

References CREATURE_FLAG_EXTRA_NO_BLOCK, CreatureTemplate::flags_extra, Creature::GetCreatureTemplate(), GetMaxSkillValueForLevel(), Object::GetTypeId(), GetUnitBlockChance(), GetWeaponSkillValue(), SpellInfo::HasAttribute(), HasAuraType(), Position::HasInArc(), HasUnitState(), IsNonMeleeSpellCast(), roll_chance_f(), SPELL_ATTR0_NO_ACTIVE_DEFENSE, SPELL_AURA_IGNORE_HIT_DIRECTION, Object::ToCreature(), TYPEID_UNIT, and UNIT_STATE_CONTROLLED.

Referenced by CalculateSpellDamageTaken().

◆ IsSpiritGuide()

bool Unit::IsSpiritGuide ( ) const
inline

◆ IsSpiritHealer()

bool Unit::IsSpiritHealer ( ) const
inline

◆ IsSpiritService()

◆ IsStandState()

◆ IsStopped()

bool Unit::IsStopped ( ) const
inline

◆ IsSummon()

bool Unit::IsSummon ( ) const
inline
1410{ return m_unitTypeMask & UNIT_MASK_SUMMON; }
@ UNIT_MASK_SUMMON
Definition: Unit.h:675

References m_unitTypeMask, and UNIT_MASK_SUMMON.

Referenced by Creature::CanPeriodicallyCallForAssistance(), spell_item_unsated_craving::CheckProc(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), Spell::EffectScriptEffect(), boss_skeram::EnterCombat(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::EnterCombat(), boss_skeram::EnterEvadeMode(), npc_phantom_hallucination::npc_phantom_hallucinationAI::EnterEvadeMode(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::EnterEvadeMode(), SuckBackEvent::Execute(), Spell::finish(), GetAllMinionsByEntry(), SmartScript::GetTargets(), WorldSession::HandleDismissCritter(), WorldSession::HandlePetActionHelper(), spell_pri_lightwell::HandleScriptEffect(), TempSummon::InitStats(), SpellClickInfo::IsFitToRequirements(), boss_skeram::JustDied(), boss_tyrannus::boss_tyrannusAI::JustDied(), boss_freya_iron_root::boss_freya_iron_rootAI::JustDied(), boss_yoggsaron_influence_tentacle::boss_yoggsaron_influence_tentacleAI::JustDied(), npc_counselor_talbot::npc_counselor_talbotAI::JustDied(), boss_essence_of_anger::boss_essence_of_angerAI::JustDied(), npc_pet_dk_ghoul::npc_pet_dk_ghoulAI::JustDied(), npc_pet_pri_shadowfiend::JustDied(), npc_tiger_matriarch::npc_tiger_matriarchAI::KilledUnit(), npc_leryssa::npc_leryssaAI::MovementInform(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::npc_attracted_reef_bullAI(), BattlefieldWG::OnCreatureCreate(), instance_blackfathom_deeps::instance_blackfathom_deeps_InstanceMapScript::OnCreatureCreate(), npc_wormhole::OnGossipHello(), instance_blackfathom_deeps::instance_blackfathom_deeps_InstanceMapScript::OnUnitDeath(), RemoveAllControlled(), RemoveAllMinionsByEntry(), npc_stormforged_lieutenant::npc_stormforged_lieutenantAI::Reset(), npc_plaguehound_tracker::npc_plaguehound_trackerAI::Reset(), Creature::SaveRespawnTime(), Creature::SearchFormation(), Spell::SelectImplicitCasterObjectTargets(), Creature::SelectVictim(), npc_ulduar_flames_spread::npc_ulduar_flames_spreadAI::SpellHit(), ToTempSummon(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), boss_skeram::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), npc_ulduar_flash_freeze::npc_ulduar_flash_freezeAI::UpdateAI(), npc_vh_void_sentry::npc_vh_void_sentryAI::UpdateAI(), and Player::VehicleSpellInitialize().

◆ isSwimming()

◆ IsTabardDesigner()

bool Unit::IsTabardDesigner ( ) const
inline

◆ isTargetableForAttack()

bool Unit::isTargetableForAttack ( bool  checkFakeDeath = true,
Unit const *  byWho = nullptr 
) const

◆ IsTaxi()

bool Unit::IsTaxi ( ) const
inline

◆ IsTotem()

◆ IsTrainer()

◆ IsTriggeredAtSpellProcEvent()

bool Unit::IsTriggeredAtSpellProcEvent ( Unit victim,
Aura aura,
WeaponAttackType  attType,
bool  isVictim,
bool  active,
SpellProcEventEntry const *&  spellProcEvent,
ProcEventInfo const &  eventInfo 
)
private
17558{
17559 SpellInfo const* spellProto = aura->GetSpellInfo();
17560 SpellInfo const* procSpell = eventInfo.GetSpellInfo();
17561
17562 // let the aura be handled by new proc system if it has new entry
17563 if (sSpellMgr->GetSpellProcEntry(spellProto->Id))
17564 return false;
17565
17566 // Get proc Event Entry
17567 spellProcEvent = sSpellMgr->GetSpellProcEvent(spellProto->Id);
17568
17569 // Get EventProcFlag
17570 uint32 EventProcFlag;
17571 if (spellProcEvent && spellProcEvent->procFlags) // if exist get custom spellProcEvent->procFlags
17572 EventProcFlag = spellProcEvent->procFlags;
17573 else
17574 EventProcFlag = spellProto->ProcFlags; // else get from spell proto
17575 // Continue if no trigger exist
17576 if (!EventProcFlag)
17577 return false;
17578
17579 // Additional checks for triggered spells (ignore trap casts)
17580 //if (procExtra & PROC_EX_INTERNAL_TRIGGERED && !(procFlag & PROC_FLAG_DONE_TRAP_ACTIVATION))
17581 //{
17582 // if (!spellProto->HasAttribute(SPELL_ATTR3_CAN_PROC_TRIGGERED))
17583 // return false;
17584 //}
17585
17586 // Xinef: additional check for player auras - only player spells can trigger player proc auras
17587 // Xinef: skip victim auras
17588 // Excluded player shoot spells
17589 // Excluded player item spells
17590 if (!isVictim && IsPlayer() && !(EventProcFlag & (PROC_FLAG_KILL | PROC_FLAG_DEATH)))
17591 {
17592 if (procSpell && procSpell->SpellFamilyName == SPELLFAMILY_GENERIC && procSpell->GetCategory() != 76 &&
17593 (!eventInfo.GetProcSpell() || !eventInfo.GetProcSpell()->m_CastItem) &&
17594 (!eventInfo.GetTriggerAuraSpell() || eventInfo.GetTriggerAuraSpell()->SpellFamilyName == SPELLFAMILY_GENERIC))
17595 {
17596 return false;
17597 }
17598 }
17599
17600 // Check spellProcEvent data requirements
17601 if (!sSpellMgr->IsSpellProcEventCanTriggeredBy(spellProto, spellProcEvent, EventProcFlag, eventInfo, active))
17602 return false;
17603 // In most cases req get honor or XP from kill
17604 if (EventProcFlag & PROC_FLAG_KILL && GetTypeId() == TYPEID_PLAYER)
17605 {
17606 bool allow = false;
17607
17608 if (victim)
17609 allow = ToPlayer()->isHonorOrXPTarget(victim);
17610
17611 // Shadow Word: Death - can trigger from every kill
17612 if (aura->GetId() == 32409 || aura->GetId() == 18372 || aura->GetId() == 18213)
17613 allow = true;
17614 if (!allow)
17615 return false;
17616 }
17617 // Aura added by spell can`t trigger from self (prevent drop charges/do triggers)
17618 // But except periodic and kill triggers (can triggered from self)
17619 if (procSpell && procSpell->Id == spellProto->Id
17620 && !(spellProto->ProcFlags & (PROC_FLAG_TAKEN_PERIODIC | PROC_FLAG_KILL)))
17621 return false;
17622
17623 // Check if current equipment allows aura to proc
17624 if (!isVictim && GetTypeId() == TYPEID_PLAYER && !spellProto->HasAttribute(SPELL_ATTR3_NO_PROC_EQUIP_REQUIREMENT))
17625 {
17626 Player* player = ToPlayer();
17627 if (spellProto->EquippedItemClass == ITEM_CLASS_WEAPON)
17628 {
17629 Item* item = nullptr;
17630 if (attType == BASE_ATTACK)
17632 else if (attType == OFF_ATTACK)
17634 else
17636
17637 if (player->IsInFeralForm())
17638 return false;
17639
17640 if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_WEAPON || !((1 << item->GetTemplate()->SubClass) & spellProto->EquippedItemSubClassMask))
17641 return false;
17642 }
17643 else if (spellProto->EquippedItemClass == ITEM_CLASS_ARMOR)
17644 {
17645 // Check if player is wearing shield
17647 if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_ARMOR || !((1 << item->GetTemplate()->SubClass) & spellProto->EquippedItemSubClassMask))
17648 return false;
17649 }
17650 }
17651 // Get chance from spell
17652 float chance = float(spellProto->ProcChance);
17653 // If in spellProcEvent exist custom chance, chance = spellProcEvent->customChance;
17654 if (spellProcEvent && spellProcEvent->customChance)
17655 chance = spellProcEvent->customChance;
17656 // If PPM exist calculate chance from PPM
17657 if (spellProcEvent && spellProcEvent->ppmRate != 0)
17658 {
17659 if (!isVictim)
17660 {
17661 uint32 WeaponSpeed = GetAttackTime(attType);
17662 chance = GetPPMProcChance(WeaponSpeed, spellProcEvent->ppmRate, spellProto);
17663 }
17664 else if (victim)
17665 {
17666 uint32 WeaponSpeed = victim->GetAttackTime(attType);
17667 chance = victim->GetPPMProcChance(WeaponSpeed, spellProcEvent->ppmRate, spellProto);
17668 }
17669 }
17670
17671 // Custom chances
17672 switch (spellProto->SpellFamilyName)
17673 {
17675 {
17676 // Recklessness, allow to proc only once for whirlwind
17677 if (spellProto->Id == 1719 && procSpell && procSpell->Id == 44949)
17678 return false;
17679 }
17680 }
17681
17682 if (eventInfo.GetProcChance())
17683 {
17684 chance = *eventInfo.GetProcChance();
17685 }
17686
17687 // Apply chance modifer aura
17688 if (Player* modOwner = GetSpellModOwner())
17689 {
17690 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CHANCE_OF_SUCCESS, chance);
17691 }
17692
17693 return roll_chance_f(chance);
17694}
@ ITEM_CLASS_ARMOR
Definition: ItemTemplate.h:304
@ ITEM_CLASS_WEAPON
Definition: ItemTemplate.h:302
@ EQUIPMENT_SLOT_RANGED
Definition: Player.h:693
@ SPELLMOD_CHANCE_OF_SUCCESS
Definition: SpellDefines.h:95
@ PROC_FLAG_DEATH
Definition: SpellMgr.h:143
@ PROC_FLAG_TAKEN_PERIODIC
Definition: SpellMgr.h:135
@ PROC_FLAG_KILL
Definition: SpellMgr.h:108
@ SPELL_ATTR3_NO_PROC_EQUIP_REQUIREMENT
Definition: SharedDefines.h:466
uint32 Class
Definition: ItemTemplate.h:630
uint32 SubClass
Definition: ItemTemplate.h:631
Item * GetUseableItemByPos(uint8 bag, uint8 slot) const
Definition: Player.h:1220
bool isHonorOrXPTarget(Unit *victim) const
Definition: Player.cpp:12558
float GetPPMProcChance(uint32 WeaponSpeed, float PPM, SpellInfo const *spellProto) const
Definition: Unit.cpp:13367
uint32 GetCategory() const
Definition: SpellInfo.cpp:864
int32 EquippedItemClass
Definition: SpellInfo.h:373
uint32 ProcFlags
Definition: SpellInfo.h:353
int32 EquippedItemSubClassMask
Definition: SpellInfo.h:374

References BASE_ATTACK, ItemTemplate::Class, SpellProcEventEntry::customChance, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, SpellInfo::EquippedItemClass, SpellInfo::EquippedItemSubClassMask, GetAttackTime(), SpellInfo::GetCategory(), Aura::GetId(), GetPPMProcChance(), ProcEventInfo::GetProcChance(), ProcEventInfo::GetProcSpell(), ProcEventInfo::GetSpellInfo(), Aura::GetSpellInfo(), GetSpellModOwner(), Item::GetTemplate(), ProcEventInfo::GetTriggerAuraSpell(), Object::GetTypeId(), Player::GetUseableItemByPos(), SpellInfo::HasAttribute(), SpellInfo::Id, INVENTORY_SLOT_BAG_0, Item::IsBroken(), Player::isHonorOrXPTarget(), IsInFeralForm(), Object::IsPlayer(), ITEM_CLASS_ARMOR, ITEM_CLASS_WEAPON, Spell::m_CastItem, OFF_ATTACK, SpellProcEventEntry::ppmRate, PROC_FLAG_DEATH, PROC_FLAG_KILL, PROC_FLAG_TAKEN_PERIODIC, SpellInfo::ProcChance, SpellInfo::ProcFlags, SpellProcEventEntry::procFlags, roll_chance_f(), SPELL_ATTR3_NO_PROC_EQUIP_REQUIREMENT, SPELLFAMILY_GENERIC, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyName, SPELLMOD_CHANCE_OF_SUCCESS, sSpellMgr, ItemTemplate::SubClass, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by ProcDamageAndSpellFor().

◆ isTurning()

bool Unit::isTurning ( ) const
inline

◆ IsUnderLastManaUseEffect()

bool Unit::IsUnderLastManaUseEffect ( ) const

◆ IsUnderWater()

bool Unit::IsUnderWater ( ) const
virtual
4285{
4287}
@ LIQUID_MAP_UNDER_WATER
Definition: Map.h:147

References WorldObject::GetLiquidData(), LIQUID_MAP_UNDER_WATER, and LiquidData::Status.

Referenced by HasInLineCheck::operator()(), and Creature::setDeathState().

◆ IsValidAssistTarget()

bool Unit::IsValidAssistTarget ( Unit const *  target) const
13902{
13903 return _IsValidAssistTarget(target, nullptr);
13904}
bool _IsValidAssistTarget(Unit const *target, SpellInfo const *bySpell) const
Definition: Unit.cpp:13907

References _IsValidAssistTarget().

Referenced by SmartAI::AssistPlayerInCombatAgainst().

◆ IsValidAttackTarget()

bool Unit::IsValidAttackTarget ( Unit const *  target,
SpellInfo const *  bySpell = nullptr 
) const
13782{
13783 return _IsValidAttackTarget(target, bySpell);
13784}

References _IsValidAttackTarget().

Referenced by npc_escortAI::AssistPlayerInCombatAgainst(), Creature::CanCreatureAttack(), spell_pal_holy_shock::CheckCast(), spell_pri_penance::CheckCast(), npc_beryl_sorcerer::npc_beryl_sorcererAI::EnterCombat(), CreatureGroup::GetNewTargetForMember(), WorldSession::HandleAttackSwingOpcode(), CreatureGroup::MemberEngagingTarget(), npc_towering_infernal::npc_towering_infernalAI::MoveInLineOfSight(), npc_lesser_doomguard::npc_lesser_doomguardAI::MoveInLineOfSight(), alliance_rifleman::alliance_riflemanAI::MoveInLineOfSight(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::MoveInLineOfSight(), boss_doomwalker::boss_doomwalkerAI::MoveInLineOfSight(), boss_kaelthas::boss_kaelthasAI::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MySelectNextTarget(), Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator()(), Acore::NearestHostileUnitCheck::operator()(), MalleableGooSelector::operator()(), Acore::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck::operator()(), SelectNearbyNoTotemTarget(), SelectNearbyTarget(), CreatureAI::SetGazeOn(), StopAttackingInvalidTarget(), SimpleCharmedAI::UpdateAI(), npc_anubarak_spike::npc_anubarak_spikeAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_addAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), PossessedAI::UpdateAI(), Player::UpdateCharmedAI(), Player::UpdateFFAPvPFlag(), and Player::UpdateFFAPvPState().

◆ IsVehicle()

bool Unit::IsVehicle ( ) const
inline

References m_unitTypeMask, and UNIT_MASK_VEHICLE.

Referenced by Battleground::AddCreature(), Creature::AddToWorld(), ApplyResilience(), CanHaveThreatList(), spell_wintergrasp_water::spell_wintergrasp_water_SpellScript::CheckCast(), Spell::CheckEffectTarget(), SpellInfo::CheckTarget(), Map::CreatureRelocation(), DealDamage(), DealMeleeDamage(), Spell::EffectDummy(), Spell::EffectKnockBack(), Spell::EffectSummonType(), CreatureAI::EnterEvadeMode(), SmartScript::GetTargets(), GetVelocity(), AuraEffect::HandleAuraControlVehicle(), debug_commandscript::HandleDebugEnterVehicleCommand(), debug_commandscript::HandleDebugSetVehicleIdCommand(), spell_q13280_13283_plant_battle_standard::HandleDummy(), BattlefieldWG::HandleKill(), BattlegroundIC::HandleKillUnit(), WorldSession::HandlePetActionHelper(), spell_q12919_gymers_throw::HandleScript(), spell_putricide_mutated_transformation::spell_putricide_mutated_transformation_SpellScript::HandleSummon(), TempSummon::InitStats(), KillRewarder::KillRewarder(), spell_igb_overheat::spell_igb_overheat_AuraScript::Load(), MagicSpellHitResult(), npc_brann_radio::npc_brann_radioAI::MoveInLineOfSight(), BattlefieldWG::OnUnitDeath(), OutDebugInfo(), VehicleAI::Permissible(), Map::PlayerRelocation(), RemoveCharmedBy(), RemoveFromWorld(), Spell::SelectImplicitCasterObjectTargets(), SetCharmedBy(), SetOwnerGUID(), SetSpeed(), Player::StopCastingCharm(), UpdateCharmAI(), Creature::UpdateEntry(), UpdateHeight(), UpdateOrientation(), and UpdateSpeed().

◆ IsVendor()

◆ IsVisible()

bool Unit::IsVisible ( ) const
inline
@ SEC_PLAYER
Definition: Common.h:66
@ SERVERSIDE_VISIBILITY_GM
Definition: SharedDefines.h:1245
T_VALUES GetValue(FLAG_TYPE flag) const
Definition: Object.h:359

References FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::GetValue(), WorldObject::m_serverSideVisibility, SEC_PLAYER, and SERVERSIDE_VISIBILITY_GM.

Referenced by npc_ghostly_priest::npc_ghostly_priestAI::AttackStart(), npc_phantom_mage::npc_phantom_mageAI::AttackStart(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::AttackStart(), npc_spectral_footman::npc_spectral_footmanAI::AttackStart(), npc_tortured_rifleman::npc_tortured_riflemanAI::AttackStart(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::CanAIAttack(), boss_professor_putricide::boss_professor_putricideAI::CanAIAttack(), boss_sindragosa::boss_sindragosaAI::CanAIAttack(), boss_the_lich_king::boss_the_lich_kingAI::CanAIAttack(), SpellInfo::CheckTarget(), boss_the_lich_king::boss_the_lich_kingAI::EnterCombat(), boss_sindragosa::boss_sindragosaAI::EnterCombat(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::EnterCombat(), boss_professor_putricide::boss_professor_putricideAI::EnterCombat(), AuraEffect::HandlePhase(), Player::IsVisibleGloballyFor(), Acore::AllFriendlyCreaturesInGrid::operator()(), boss_sapphiron::boss_sapphironAI::Reset(), npc_pos_leader::npc_pos_leaderAI::SetData(), boss_midnight::boss_midnightAI::UpdateAI(), boss_archimonde::boss_archimondeAI::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), boss_taldaram::UpdateAI(), npc_big_ooze::npc_big_oozeAI::UpdateAI(), and boss_vazruden_the_herald::boss_vazruden_the_heraldAI::UpdateAI().

◆ IsWalking()

◆ IsWithinCombatRange()

bool Unit::IsWithinCombatRange ( Unit const *  obj,
float  dist2compare 
) const

◆ IsWithinMeleeRange()

bool Unit::IsWithinMeleeRange ( Unit const *  obj,
float  dist = 0.f 
) const
684{
685 if (!obj || !IsInMap(obj) || !InSamePhase(obj))
686 return false;
687
688 float dx = GetPositionX() - obj->GetPositionX();
689 float dy = GetPositionY() - obj->GetPositionY();
690 float dz = GetPositionZ() - obj->GetPositionZ();
691 float distsq = dx * dx + dy * dy + dz * dz;
692
693 float maxdist = dist + GetMeleeRange(obj);
694
695 return distsq < maxdist * maxdist;
696}

References GetMeleeRange(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::InSamePhase(), and WorldObject::IsInMap().

Referenced by SmartAI::AttackStart(), boss_ragnaros::boss_ragnarosAI::CanAIAttack(), boss_ouro::CanAIAttack(), PetAI::CanAttack(), boss_archimonde::boss_archimondeAI::CanUseFingerOfDeath(), Spell::CheckRange(), UnitAI::DoMeleeAttackIfReady(), boss_zuljin::boss_zuljinAI::DoMeleeAttackIfReady(), boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), boss_vem::EnterCombat(), generic_creature::generic_creatureAI::EnterCombat(), spell_shazzrah_gate_dummy::spell_shazzrah_gate_dummy_SpellScript::FilterTargets(), boss_supremus::boss_supremusAI::FindHatefulStrikeTarget(), boss_ouro::IsPlayerWithinMeleeRange(), boss_ragnaros::boss_ragnarosAI::IsVictimWithinMeleeRange(), CreatureAI::MoveCircleChecks(), boss_twin_valkyrAI::myDoMeleeAttackIfReady(), SpellTargetSelector::operator()(), ThreatContainer::SelectNextVictim(), boss_quartermaster_zigris::SpellHitTarget(), Player::Update(), boss_quartermaster_zigris::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), boss_zuljin::boss_zuljinAI::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), boss_marli::UpdateAI(), boss_skeram::UpdateAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), boss_marwyn::boss_marwynAI::UpdateAI(), npc_hor_lumbering_abomination::npc_hor_lumbering_abominationAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_darnavan::npc_darnavanAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_blazing_skeleton::npc_blazing_skeletonAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_kologarn::boss_kologarnAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), npc_ulduar_dark_rune_guardian::npc_ulduar_dark_rune_guardianAI::UpdateAI(), npc_ulduar_dark_rune_sentinel::npc_ulduar_dark_rune_sentinelAI::UpdateAI(), boss_skarvald_the_constructor::boss_skarvald_the_constructorAI::UpdateAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::UpdateAI(), boss_murmur::boss_murmurAI::UpdateAI(), boss_shade_of_akama::boss_shade_of_akamaAI::UpdateAI(), boss_lady_vashj::boss_lady_vashjAI::UpdateAI(), boss_the_lurker_below::boss_the_lurker_belowAI::UpdateAI(), boss_omor_the_unscarred::boss_omor_the_unscarredAI::UpdateAI(), boss_alar::boss_alarAI::UpdateAI(), generic_creature::generic_creatureAI::UpdateAI(), PetAI::UpdateAI(), npc_zuljin_vortex::npc_zuljin_vortexAI::UpdateAI(), npc_suppresser::npc_suppresserAI::UpdateAI(), and boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::UpdateAI().

◆ IsWithinRange()

bool Unit::IsWithinRange ( Unit const *  obj,
float  dist 
) const
705{
706 if (!obj || !IsInMap(obj) || !InSamePhase(obj))
707 {
708 return false;
709 }
710
711 auto dx = GetPositionX() - obj->GetPositionX();
712 auto dy = GetPositionY() - obj->GetPositionY();
713 auto dz = GetPositionZ() - obj->GetPositionZ();
714 auto distsq = dx * dx + dy * dy + dz * dz;
715
716 return distsq <= dist * dist;
717}

References Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::InSamePhase(), and WorldObject::IsInMap().

◆ JumpTo() [1/2]

void Unit::JumpTo ( float  speedXY,
float  speedZ,
bool  forward = true 
)
19654{
19655 float angle = forward ? 0 : M_PI;
19656 if (GetTypeId() == TYPEID_UNIT)
19657 GetMotionMaster()->MoveJumpTo(angle, speedXY, speedZ);
19658 else
19659 {
19660 float vcos = cos(angle + GetOrientation());
19661 float vsin = std::sin(angle + GetOrientation());
19662
19663 WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8 + 4 + 4 + 4 + 4 + 4));
19664 data << GetPackGUID();
19665 data << uint32(0); // Sequence
19666 data << float(vcos); // x direction
19667 data << float(vsin); // y direction
19668 data << float(speedXY); // Horizontal speed
19669 data << float(-speedZ); // Z Movement speed (vertical)
19670
19671 ToPlayer()->GetSession()->SendPacket(&data);
19672 }
19673}
@ SMSG_MOVE_KNOCK_BACK
Definition: Opcodes.h:269
void MoveJumpTo(float angle, float speedXY, float speedZ)
Definition: MotionMaster.cpp:511
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition: WorldSession.cpp:208

References GetMotionMaster(), Position::GetOrientation(), Object::GetPackGUID(), Player::GetSession(), Object::GetTypeId(), MotionMaster::MoveJumpTo(), WorldSession::SendPacket(), SMSG_MOVE_KNOCK_BACK, Object::ToPlayer(), and TYPEID_UNIT.

Referenced by Spell::EffectLeapBack().

◆ JumpTo() [2/2]

void Unit::JumpTo ( WorldObject obj,
float  speedZ 
)
19676{
19677 float x, y, z;
19678 obj->GetContactPoint(this, x, y, z);
19679 float speedXY = GetExactDist2d(x, y) * 10.0f / speedZ;
19680 GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ);
19681}
void GetContactPoint(WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
Definition: Object.cpp:2705
void MoveJump(Position const &pos, float speedXY, float speedZ, uint32 id=0)
Definition: MotionMaster.h:225

References WorldObject::GetContactPoint(), Position::GetExactDist2d(), GetMotionMaster(), and MotionMaster::MoveJump().

◆ Kill()

void Unit::Kill ( Unit killer,
Unit victim,
bool  durabilityLoss = true,
WeaponAttackType  attackType = BASE_ATTACK,
SpellInfo const *  spellProto = nullptr,
Spell const *  spell = nullptr 
)
static
17837{
17838 // Prevent killing unit twice (and giving reward from kill twice)
17839 if (!victim->GetHealth())
17840 return;
17841
17842 if (killer && !killer->IsInMap(victim))
17843 killer = nullptr;
17844
17845 // find player: owner of controlled `this` or `this` itself maybe
17846 Player* player = killer ? killer->GetCharmerOrOwnerPlayerOrPlayerItself() : nullptr;
17847 Creature* creature = victim->ToCreature();
17848
17849 bool isRewardAllowed = true;
17850 if (creature)
17851 {
17852 isRewardAllowed = creature->IsDamageEnoughForLootingAndReward();
17853 if (!isRewardAllowed)
17854 creature->SetLootRecipient(nullptr);
17855 }
17856
17857 // pussywizard: remade this if section (player is on the same map
17858 if (isRewardAllowed && creature)
17859 {
17860 Player* lr = creature->GetLootRecipient();
17861 if (lr && lr->IsInMap(creature))
17862 player = creature->GetLootRecipient();
17863 else if (Group* lrg = creature->GetLootRecipientGroup())
17864 for (GroupReference* itr = lrg->GetFirstMember(); itr != nullptr; itr = itr->next())
17865 if (Player* member = itr->GetSource())
17866 if (member->IsAtLootRewardDistance(creature))
17867 {
17868 player = member;
17869 break;
17870 }
17871 }
17872
17873 // Exploit fix
17874 if (creature && creature->IsPet() && creature->GetOwnerGUID().IsPlayer())
17875 isRewardAllowed = false;
17876
17877 // Reward player, his pets, and group/raid members
17878 // call kill spell proc event (before real die and combat stop to triggering auras removed at death/combat stop)
17879 if (isRewardAllowed && player && player != victim)
17880 {
17881 WorldPacket data(SMSG_PARTYKILLLOG, (8 + 8)); // send event PARTY_KILL
17882 data << player->GetGUID(); // player with killing blow
17883 data << victim->GetGUID(); // victim
17884
17885 Player* looter = player;
17886 Group* group = player->GetGroup();
17887 bool hasLooterGuid = false;
17888
17889 if (group)
17890 {
17891 group->BroadcastPacket(&data, group->GetMemberGroup(player->GetGUID()));
17892
17893 if (creature)
17894 {
17895 group->UpdateLooterGuid(creature, true);
17896 if (group->GetLooterGuid() && group->GetLootMethod() != FREE_FOR_ALL)
17897 {
17898 looter = ObjectAccessor::FindPlayer(group->GetLooterGuid());
17899 if (looter)
17900 {
17901 hasLooterGuid = true;
17902 creature->SetLootRecipient(looter); // update creature loot recipient to the allowed looter.
17903 }
17904 }
17905 }
17906 }
17907 else
17908 {
17909 player->SendDirectMessage(&data);
17910
17911 if (creature)
17912 {
17913 WorldPacket data2(SMSG_LOOT_LIST, 8 + 1 + 1);
17914 data2 << creature->GetGUID();
17915 data2 << uint8(0); // unk1
17916 data2 << uint8(0); // no group looter
17917 player->SendMessageToSet(&data2, true);
17918 }
17919 }
17920
17921 // Generate loot before updating looter
17922 if (creature)
17923 {
17924 Loot* loot = &creature->loot;
17925 loot->clear();
17926
17927 if (uint32 lootid = creature->GetCreatureTemplate()->lootid)
17928 loot->FillLoot(lootid, LootTemplates_Creature, looter, false, false, creature->GetLootMode(), creature);
17929
17930 if (creature->GetLootMode())
17932
17933 if (group)
17934 {
17935 if (hasLooterGuid)
17936 group->SendLooter(creature, looter);
17937 else
17938 group->SendLooter(creature, nullptr);
17939
17940 // Update round robin looter only if the creature had loot
17941 if (!creature->loot.empty())
17942 group->UpdateLooterGuid(creature);
17943 }
17944 }
17945
17946 player->RewardPlayerAndGroupAtKill(victim, false);
17947 }
17948
17949 // Do KILL and KILLED procs. KILL proc is called only for the unit who landed the killing blow (and its owner - for pets and totems) regardless of who tapped the victim
17950 if (killer && (killer->IsPet() || killer->IsTotem()))
17951 if (Unit* owner = killer->GetOwner())
17952 {
17953 Unit::ProcDamageAndSpell(owner, victim, PROC_FLAG_KILL, PROC_FLAG_NONE, PROC_EX_NONE, 0, attackType, spellProto, nullptr, -1, spell);
17954 sScriptMgr->OnCreatureKilledByPet( killer->GetCharmerOrOwnerPlayerOrPlayerItself(), victim->ToCreature());
17955 }
17956
17957 if (killer != victim && !victim->IsCritter())
17958 Unit::ProcDamageAndSpell(killer, victim, killer ? PROC_FLAG_KILL : 0, PROC_FLAG_KILLED, PROC_EX_NONE, 0, attackType, spellProto, nullptr, -1, spell);
17959
17960 // Proc auras on death - must be before aura/combat remove
17961 Unit::ProcDamageAndSpell(victim, nullptr, PROC_FLAG_DEATH, PROC_FLAG_NONE, PROC_EX_NONE, 0, attackType, spellProto, nullptr, -1, spell);
17962
17963 // update get killing blow achievements, must be done before setDeathState to be able to require auras on target
17964 // and before Spirit of Redemption as it also removes auras
17965 if (killer)
17966 if (Player* killerPlayer = killer->GetCharmerOrOwnerPlayerOrPlayerItself())
17967 killerPlayer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, 1, 0, victim);
17968
17969 // Spirit of Redemption
17970 // if talent known but not triggered (check priest class for speedup check)
17971 bool spiritOfRedemption = false;
17972 if (victim->GetTypeId() == TYPEID_PLAYER && victim->getClass() == CLASS_PRIEST && !victim->ToPlayer()->HasPlayerFlag(PLAYER_FLAGS_IS_OUT_OF_BOUNDS))
17973 {
17974 if (AuraEffect* aurEff = victim->GetAuraEffectDummy(20711))
17975 {
17976 // Xinef: aura_spirit_of_redemption is triggered by 27827 shapeshift
17977 if (victim->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION) || victim->HasAura(27827))
17978 {
17979 /*LOG_INFO("misc", "Player ({}) died with spirit of redemption. Killer (Entry: {}, Name: {}), Map: {}, x: {}, y: {}, z: {}",
17980 victim->GetGUID().ToString(), killer ? killer->GetEntry() : 1, killer ? killer->GetName() : "", victim->GetMapId(), victim->GetPositionX(),
17981 victim->GetPositionY(), victim->GetPositionZ());
17982
17983 ACE_Stack_Trace trace(0, 50);
17984 LOG_INFO("misc", "TRACE: {}\n\n", trace);*/
17985 }
17986 else
17987 {
17988 // save value before aura remove
17989 uint32 ressSpellId = victim->GetUInt32Value(PLAYER_SELF_RES_SPELL);
17990 if (!ressSpellId)
17991 ressSpellId = victim->ToPlayer()->GetResurrectionSpellId();
17992
17993 //Remove all expected to remove at death auras (most important negative case like DoT or periodic triggers)
17994 victim->RemoveAllAurasOnDeath();
17995
17996 // Stop attacks
17997 victim->CombatStop();
17999
18000 // restore for use at real death
18001 victim->SetUInt32Value(PLAYER_SELF_RES_SPELL, ressSpellId);
18002
18003 // FORM_SPIRITOFREDEMPTION and related auras
18004 victim->CastSpell(victim, 27827, true, nullptr, aurEff);
18005 spiritOfRedemption = true;
18006 }
18007 }
18008 }
18009
18010 if (!spiritOfRedemption)
18011 {
18012 LOG_DEBUG("entities.unit", "SET JUST_DIED");
18013 victim->setDeathState(JUST_DIED);
18014 }
18015
18016 // Inform pets (if any) when player kills target)
18017 // MUST come after victim->setDeathState(JUST_DIED); or pet next target
18018 // selection will get stuck on same target and break pet react state
18019 if (player)
18020 {
18021 Pet* pet = player->GetPet();
18022 if (pet && pet->IsAlive() && pet->isControlled())
18023 pet->AI()->KilledUnit(victim);
18024 }
18025
18026 // 10% durability loss on death
18027 // clean InHateListOf
18028 if (Player* plrVictim = victim->ToPlayer())
18029 {
18030 // remember victim PvP death for corpse type and corpse reclaim delay
18031 // at original death (not at SpiritOfRedemtionTalent timeout)
18032 plrVictim->SetPvPDeath(player != nullptr);
18033
18034 // only if not player and not controlled by player pet. And not at BG
18035 if ((durabilityLoss && !player && !plrVictim->InBattleground()) || (player && sWorld->getBoolConfig(CONFIG_DURABILITY_LOSS_IN_PVP)))
18036 {
18037 LOG_DEBUG("entities.unit", "We are dead, losing {} percent durability", sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH));
18038 plrVictim->DurabilityLossAll(sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH), false);
18039 // durability lost message
18040 plrVictim->SendDurabilityLoss();
18041 }
18042 // Call KilledUnit for creatures
18043 if (killer && killer->GetTypeId() == TYPEID_UNIT && killer->IsAIEnabled)
18044 killer->ToCreature()->AI()->KilledUnit(victim);
18045
18046 // last damage from non duel opponent or opponent controlled creature
18047 if (plrVictim->duel)
18048 {
18049 plrVictim->duel->Opponent->CombatStopWithPets(true);
18050 plrVictim->CombatStopWithPets(true);
18051 plrVictim->DuelComplete(DUEL_INTERRUPTED);
18052 }
18053 }
18054 else // creature died
18055 {
18056 LOG_DEBUG("entities.unit", "DealDamageNotPlayer");
18057
18058 if (!creature->IsPet() && creature->GetLootMode() > 0)
18059 {
18060 creature->GetThreatMgr().ClearAllThreat();
18061
18062 // must be after setDeathState which resets dynamic flags
18063 if (!creature->loot.isLooted())
18064 {
18066 }
18067 else
18068 {
18069 creature->AllLootRemovedFromCorpse();
18070 }
18071 }
18072
18073 // Call KilledUnit for creatures, this needs to be called after the lootable flag is set
18074 if (killer && killer->GetTypeId() == TYPEID_UNIT && killer->IsAIEnabled)
18075 killer->ToCreature()->AI()->KilledUnit(victim);
18076
18077 // Call creature just died function
18078 if (CreatureAI* ai = creature->AI())
18079 {
18080 ai->JustDied(killer);
18081 sScriptMgr->OnUnitDeath(creature, killer);
18082 }
18083
18084 if (TempSummon* summon = creature->ToTempSummon())
18085 {
18086 if (WorldObject* summoner = summon->GetSummoner())
18087 {
18088 if (summoner->ToCreature() && summoner->ToCreature()->IsAIEnabled)
18089 {
18090 summoner->ToCreature()->AI()->SummonedCreatureDies(creature, killer);
18091 }
18092 else if (summoner->ToGameObject() && summoner->ToGameObject()->AI())
18093 {
18094 summoner->ToGameObject()->AI()->SummonedCreatureDies(creature, killer);
18095 }
18096 }
18097 }
18098
18099 // Dungeon specific stuff, only applies to players killing creatures
18100 if (creature->GetInstanceId())
18101 {
18102 Map* instanceMap = creature->GetMap();
18103 //Player* creditedPlayer = GetCharmerOrOwnerPlayerOrPlayerItself();
18104 // TODO: do instance binding anyway if the charmer/owner is offline
18105
18106 if (instanceMap->IsDungeon() && player)
18107 if (instanceMap->IsRaidOrHeroicDungeon())
18109 instanceMap->ToInstanceMap()->PermBindAllPlayers();
18110 }
18111 }
18112
18113 // outdoor pvp things, do these after setting the death state, else the player activity notify won't work... doh...
18114 // handle player kill only if not suicide (spirit of redemption for example)
18115 if (player && killer != victim)
18116 {
18117 if (OutdoorPvP* pvp = player->GetOutdoorPvP())
18118 pvp->HandleKill(player, victim);
18119
18120 if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()))
18121 bf->HandleKill(player, victim);
18122 }
18123
18124 //if (victim->GetTypeId() == TYPEID_PLAYER)
18125 // if (OutdoorPvP* pvp = victim->ToPlayer()->GetOutdoorPvP())
18126 // pvp->HandlePlayerActivityChangedpVictim->ToPlayer();
18127
18128 // battleground things (do this at the end, so the death state flag will be properly set to handle in the bg->handlekill)
18129 if (player)
18130 if (Battleground* bg = player->GetBattleground())
18131 {
18132 if (victim->GetTypeId() == TYPEID_PLAYER)
18133 bg->HandleKillPlayer(victim->ToPlayer(), player);
18134 else
18135 bg->HandleKillUnit(victim->ToCreature(), player);
18136 }
18137
18138 // achievement stuff
18139 if (killer && victim->GetTypeId() == TYPEID_PLAYER)
18140 {
18141 if (killer->GetTypeId() == TYPEID_UNIT)
18143 else if (victim != killer && killer->GetTypeId() == TYPEID_PLAYER)
18145 }
18146
18147 // Hook for OnPVPKill Event
18148 if (killer)
18149 {
18150 if (Player* killerPlr = killer->ToPlayer())
18151 {
18152 if (Player* killedPlr = victim->ToPlayer())
18153 sScriptMgr->OnPVPKill(killerPlr, killedPlr);
18154 else if (Creature* killedCre = victim->ToCreature())
18155 sScriptMgr->OnCreatureKill(killerPlr, killedCre);
18156 }
18157 else if (Creature* killerCre = killer->ToCreature())
18158 {
18159 if (Player* killed = victim->ToPlayer())
18160 sScriptMgr->OnPlayerKilledByCreature(killerCre, killed);
18161 }
18162 }
18163}
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:77
@ CREATURE_FLAG_EXTRA_INSTANCE_BIND
Definition: CreatureData.h:49
@ PLAYER_SELF_RES_SPELL
Definition: UpdateFields.h:370
@ PLAYER_FLAGS_IS_OUT_OF_BOUNDS
Definition: Player.h:489
LootStore LootTemplates_Creature("creature_loot_template", "creature entry", true)
@ FREE_FOR_ALL
Definition: LootMgr.h:59
@ PROC_FLAG_KILLED
Definition: SpellMgr.h:107
@ CONFIG_DURABILITY_LOSS_IN_PVP
Definition: IWorld.h:71
@ RATE_DURABILITY_LOSS_ON_DEATH
Definition: IWorld.h:501
@ ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER
Definition: DBCEnums.h:144
@ ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE
Definition: DBCEnums.h:143
@ ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS
Definition: DBCEnums.h:176
@ DUEL_INTERRUPTED
Definition: SharedDefines.h:3584
@ SMSG_PARTYKILLLOG
Definition: Opcodes.h:531
@ SMSG_LOOT_LIST
Definition: Opcodes.h:1047
Player * FindPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:250
Definition: CreatureAI.h:70
virtual void KilledUnit(Unit *)
Definition: CreatureAI.h:125
Definition: Battlefield.h:205
Loot loot
Definition: Creature.h:218
uint16 GetLootMode() const
Definition: Creature.h:232
void AllLootRemovedFromCorpse()
Definition: Creature.cpp:2873
Player * GetLootRecipient() const
Definition: Creature.cpp:1269
bool IsDamageEnoughForLootingAndReward() const
Definition: Creature.cpp:3665
Group * GetLootRecipientGroup() const
Definition: Creature.cpp:1276
uint32 mingold
Definition: CreatureData.h:224
uint32 maxgold
Definition: CreatureData.h:225
uint32 lootid
Definition: CreatureData.h:217
virtual void SetDynamicFlag(uint32 flag)
Definition: Object.h:117
uint32 GetInstanceId() const
Definition: Object.h:431
uint32 GetZoneId() const
Definition: Object.cpp:3075
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:5594
TeamId GetTeamId(bool original=false) const
Definition: Player.h:2059
Battleground * GetBattleground(bool create=false) const
Definition: Player.cpp:12093
uint32 GetResurrectionSpellId()
Definition: Player.cpp:12501
OutdoorPvP * GetOutdoorPvP() const
Definition: Player.cpp:12402
void RewardPlayerAndGroupAtKill(Unit *victim, bool isBattleGround)
Definition: Player.cpp:12618
void RemoveAllAurasOnDeath()
Definition: Unit.cpp:5269
AuraEffect * GetAuraEffectDummy(uint32 spellid) const
Definition: Unit.cpp:5468
bool IsCritter() const
Definition: Unit.h:1674
void BroadcastPacket(WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignore=ObjectGuid::Empty)
Definition: Group.cpp:1725
uint8 GetMemberGroup(ObjectGuid guid) const
Definition: Group.cpp:2323
ObjectGuid GetLooterGuid() const
Definition: Group.cpp:2260
LootMethod GetLootMethod() const
Definition: Group.cpp:2255
void UpdateLooterGuid(WorldObject *pLootedObject, bool ifneed=false)
Definition: Group.cpp:1836
void SendLooter(Creature *creature, Player *pLooter)
Definition: Group.cpp:967
Definition: LootMgr.h:313
bool empty() const
Definition: LootMgr.h:367
bool isLooted() const
Definition: LootMgr.h:368
void clear()
Definition: LootMgr.h:343
void generateMoneyLoot(uint32 minAmount, uint32 maxAmount)
Definition: LootMgr.cpp:808
bool FillLoot(uint32 lootId, LootStore const &store, Player *lootOwner, bool personal, bool noEmptyError=false, uint16 lootMode=LOOT_MODE_DEFAULT, WorldObject *lootSource=nullptr)
Definition: LootMgr.cpp:546
Definition: Map.h:312
bool IsRaidOrHeroicDungeon() const
Definition: Map.h:450
InstanceMap * ToInstanceMap()
Definition: Map.h:544
void PermBindAllPlayers()
Definition: Map.cpp:3131
Definition: OutdoorPvP.h:197

References ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE, ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER, Creature::AI(), Creature::AllLootRemovedFromCorpse(), Group::BroadcastPacket(), CastSpell(), CLASS_PRIEST, Loot::clear(), ThreatMgr::ClearAllThreat(), CombatStop(), CONFIG_DURABILITY_LOSS_IN_PVP, CREATURE_FLAG_EXTRA_INSTANCE_BIND, HostileRefMgr::deleteReferences(), DUEL_INTERRUPTED, Loot::empty(), Loot::FillLoot(), ObjectAccessor::FindPlayer(), CreatureTemplate::flags_extra, FREE_FOR_ALL, Loot::generateMoneyLoot(), GetAuraEffectDummy(), Player::GetBattleground(), GetCharmerOrOwnerPlayerOrPlayerItself(), getClass(), Creature::GetCreatureTemplate(), Object::GetEntry(), Player::GetGroup(), Object::GetGUID(), GetHealth(), getHostileRefMgr(), WorldObject::GetInstanceId(), Group::GetLooterGuid(), Group::GetLootMethod(), Creature::GetLootMode(), Creature::GetLootRecipient(), Creature::GetLootRecipientGroup(), WorldObject::GetMap(), Group::GetMemberGroup(), Player::GetOutdoorPvP(), GetOwner(), GetOwnerGUID(), Player::GetPet(), Player::GetResurrectionSpellId(), Player::GetTeamId(), GetThreatMgr(), Object::GetTypeId(), Object::GetUInt32Value(), WorldObject::GetZoneId(), HasAura(), HasAuraType(), Player::HasPlayerFlag(), Player::InBattleground(), IsAIEnabled, IsAlive(), Pet::isControlled(), IsCritter(), Creature::IsDamageEnoughForLootingAndReward(), Map::IsDungeon(), WorldObject::IsInMap(), Loot::isLooted(), IsPet(), ObjectGuid::IsPlayer(), Map::IsRaidOrHeroicDungeon(), IsTotem(), JUST_DIED, CreatureAI::KilledUnit(), LOG_DEBUG, Creature::loot, CreatureTemplate::lootid, LootTemplates_Creature, CreatureTemplate::maxgold, CreatureTemplate::mingold, GroupReference::next(), InstanceMap::PermBindAllPlayers(), PLAYER_FLAGS_IS_OUT_OF_BOUNDS, PLAYER_SELF_RES_SPELL, PROC_EX_NONE, PROC_FLAG_DEATH, PROC_FLAG_KILL, PROC_FLAG_KILLED, PROC_FLAG_NONE, ProcDamageAndSpell(), RATE_DURABILITY_LOSS_ON_DEATH, RemoveAllAurasOnDeath(), Player::RewardPlayerAndGroupAtKill(), sBattlefieldMgr, Player::SendDirectMessage(), Group::SendLooter(), Player::SendMessageToSet(), setDeathState(), Object::SetDynamicFlag(), Creature::SetLootRecipient(), Object::SetUInt32Value(), SMSG_LOOT_LIST, SMSG_PARTYKILLLOG, SPELL_AURA_SPIRIT_OF_REDEMPTION, sScriptMgr, sWorld, Object::ToCreature(), Map::ToInstanceMap(), Object::ToPlayer(), ToTempSummon(), TYPEID_PLAYER, TYPEID_UNIT, UNIT_DYNFLAG_LOOTABLE, Player::UpdateAchievementCriteria(), and Group::UpdateLooterGuid().

Referenced by npc_mograine::npc_mograineAI::AshbringerEvent(), boss_shade_of_akama::boss_shade_of_akamaAI::ChannelersAction(), boss_headless_horseman_head::DamageTaken(), boss_viscidus::DamageTaken(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::DamageTaken(), boss_brutallus::boss_brutallusAI::DamageTaken(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::DamageTaken(), DealDamage(), boss_jedoga_shadowseeker::DoAction(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::DoAction(), boss_illidari_council::boss_illidari_councilAI::DoAction(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::EnterEvadeMode(), boss_sindragosa::boss_sindragosaAI::EnterEvadeMode(), LichKingDeathEvent::Execute(), DeathEvent::Execute(), AuraEffect::HandleAuraControlVehicle(), BattlegroundIC::HandleCapturedNodes(), misc_commandscript::HandleDieCommand(), spell_ooze_zap_channel_end::spell_ooze_zap_channel_end_SpellScript::HandleDummy(), spell_pos_rimefang_frost_nova::spell_pos_rimefang_frost_novaSpellScript::HandleDummy(), spell_q12589_shoot_rjr::spell_q12589_shoot_rjr_SpellScript::HandleDummy(), spell_item_chicken_cover::HandleDummy(), spell_yogg_saron_titanic_storm::spell_yogg_saron_titanic_storm_SpellScript::HandleDummyEffect(), spell_item_rocket_chicken::HandleDummyTick(), spell_mc_play_dead::spell_mc_play_dead_AuraScript::HandleEffectRemove(), spell_voa_overcharge::spell_voa_overcharge_AuraScript::HandlePeriodicDummy(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_felmyst_fog_of_corruption_charm::spell_felmyst_fog_of_corruption_charm_AuraScript::HandleRemove(), spell_leotheras_clear_consuming_madness::spell_leotheras_clear_consuming_madness_SpellScript::HandleScriptEffect(), boss_kiljaeden::boss_kiljaedenAI::JustDied(), boss_entropius::boss_entropiusAI::JustDied(), npc_eye_tentacle::JustDied(), npc_claw_tentacle::JustDied(), npc_giant_claw_tentacle::JustDied(), npc_giant_eye_tentacle::JustDied(), boss_twin_valkyrAI::JustDied(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), boss_sister_svalna::boss_sister_svalnaAI::JustDied(), boss_ignis::boss_ignisAI::JustDied(), boss_essence_of_anger::boss_essence_of_angerAI::JustDied(), boss_nethermancer_sepethrea::boss_nethermancer_sepethreaAI::JustDied(), boss_twinemperorsAI::JustDied(), boss_halion::boss_halionAI::JustDied(), boss_twilight_halion::boss_twilight_halionAI::JustDied(), KillSelf(), boss_buru::ManipulateEggs(), npc_burning_spirit::npc_burning_spiritAI::MovementInform(), spell_yogg_saron_insane::spell_yogg_saron_insane_AuraScript::OnRemove(), WretchedGhoulCleaner::operator()(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::PassengerBoarded(), spell_ulduar_arachnopod_damaged::spell_ulduar_arachnopod_damaged_AuraScript::PrepareAuraScript(), SmartScript::ProcessAction(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::RandomizeCompositionsAndShow(), instance_the_black_morass::instance_the_black_morass_InstanceMapScript::SetData(), boss_faerlina::boss_faerlinaAI::SpellHit(), npc_cos_stratholme_citizien::npc_cos_stratholme_citizienAI::SpellHit(), boss_sister_svalna::boss_sister_svalnaAI::SpellHitTarget(), npc_oculus_drake::npc_oculus_drakeAI::SpellHitTarget(), boss_ahune::boss_ahuneAI::SummonedCreatureDespawn(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::Update(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::Update(), instance_shattered_halls::instance_shattered_halls_InstanceMapScript::Update(), SimpleCharmedAI::UpdateAI(), boss_selin_fireheart::boss_selin_fireheartAI::UpdateAI(), npc_crusade_persuaded::npc_crusade_persuadedAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_sjonnir_malformed_ooze::boss_sjonnir_malformed_oozeAI::UpdateAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::UpdateAI(), npc_vh_teleportation_portal::npc_vh_teleportation_portalAI::UpdateAI(), npc_sinkhole_kill_credit::npc_sinkhole_kill_creditAI::UpdateAI(), npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), socrethar::socretharAI::UpdateAI(), and npc_emily::npc_emilyAI::WaypointReached().

◆ KillSelf()

void Unit::KillSelf ( bool  durabilityLoss = true,
WeaponAttackType  attackType = BASE_ATTACK,
SpellInfo const *  spellProto = nullptr,
Spell const *  spell = nullptr 
)
inline
1551{ Kill(this, this, durabilityLoss, attackType, spellProto, spell); };

References Kill().

Referenced by npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::DoAction(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DoAction(), boss_illidari_council::boss_illidari_councilAI::DoAction(), npc_xt002_boombot::npc_xt002_boombotAI::Explode(), npc_pet_gen_plump_turkey::MovementInform(), npc_wild_wyrm::npc_wild_wyrmAI::MovementInform(), npc_announcer_toc5::npc_announcer_toc5AI::MovementInform(), boss_glob_of_viscidus::MovementInform(), SmartScript::ProcessAction(), npc_dark_iron_guzzler::SpellHit(), boss_victor_nefarius::boss_victor_nefariusAI::SummonedCreatureDies(), boss_midnight::boss_midnightAI::SummonedCreatureDies(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDies(), npc_icc_gauntlet_controller::npc_icc_gauntlet_controllerAI::SummonedCreatureDies(), boss_vazruden_the_herald::boss_vazruden_the_heraldAI::SummonedCreatureDies(), npc_warden_mellichar::npc_warden_mellicharAI::SummonedCreatureDies(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), npc_singularity::npc_singularityAI::UpdateAI(), npc_brewfest_super_brew_trigger::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_sjonnir_malformed_ooze::boss_sjonnir_malformed_oozeAI::UpdateAI(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::UpdateAI(), npc_vh_void_sentry::npc_vh_void_sentryAI::UpdateAI(), npc_voidtraveler::npc_voidtravelerAI::UpdateAI(), npc_naga_distiller::npc_naga_distillerAI::UpdateAI(), npc_target_dummy::npc_target_dummyAI::UpdateAI(), and npc_frost_tomb::npc_frost_tombAI::UpdateAI().

◆ KnockbackFrom()

void Unit::KnockbackFrom ( float  x,
float  y,
float  speedXY,
float  speedZ 
)
19282{
19283 Player* player = ToPlayer();
19284 if (!player)
19285 {
19286 if (Unit* charmer = GetCharmer())
19287 {
19288 player = charmer->ToPlayer();
19289 if (player && player->m_mover != this)
19290 player = nullptr;
19291 }
19292 }
19293
19294 if (!player)
19295 {
19296 GetMotionMaster()->MoveKnockbackFrom(x, y, speedXY, speedZ);
19297 }
19298 else
19299 {
19300 float vcos, vsin;
19301 GetSinCos(x, y, vsin, vcos);
19302
19303 WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8 + 4 + 4 + 4 + 4 + 4));
19304 data << GetPackGUID();
19305 data << uint32(0); // counter
19306 data << float(vcos); // x direction
19307 data << float(vsin); // y direction
19308 data << float(speedXY); // Horizontal speed
19309 data << float(-speedZ); // Z Movement speed (vertical)
19310
19311 player->GetSession()->SendPacket(&data);
19312
19314 player->SetCanFly(true, true);
19315
19316 sScriptMgr->AnticheatSetSkipOnePacketForASH(player, true);
19317 player->SetCanKnockback(true);
19318 }
19319}
@ SPELL_AURA_FLY
Definition: SpellAuraDefines.h:264
@ SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED
Definition: SpellAuraDefines.h:270
void GetSinCos(float x, float y, float &vsin, float &vcos) const
Definition: Position.cpp:91
SafeUnitPointer m_mover
Definition: Player.h:2282
void SetCanKnockback(bool value)
Definition: Player.h:2450
bool SetCanFly(bool apply, bool packetOnly=false) override
Definition: Player.cpp:15797
void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ)
Definition: MotionMaster.cpp:485

References GetCharmer(), GetMotionMaster(), Object::GetPackGUID(), Player::GetSession(), Position::GetSinCos(), HasAuraType(), Player::m_mover, MotionMaster::MoveKnockbackFrom(), WorldSession::SendPacket(), Player::SetCanFly(), Player::SetCanKnockback(), SMSG_MOVE_KNOCK_BACK, SPELL_AURA_FLY, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, sScriptMgr, and Object::ToPlayer().

Referenced by _ExitVehicle(), Spell::EffectKnockBack(), spell_warhead_detonate::spell_warhead_detonate_SpellScript::HandleDummy(), npc_vekjik::OnGossipSelect(), and npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI().

◆ MagicSpellHitResult()

SpellMissInfo Unit::MagicSpellHitResult ( Unit victim,
SpellInfo const *  spell 
)
3282{
3283 // Can`t miss on dead target (on skinning for example)
3284 if (!victim->IsAlive() && victim->GetTypeId() != TYPEID_PLAYER)
3285 return SPELL_MISS_NONE;
3286
3287 // vehicles cant miss
3288 if (IsVehicle())
3289 return SPELL_MISS_NONE;
3290
3291 // Spells with SPELL_ATTR3_ALWAYS_HIT will additionally fully ignore
3292 // resist and deflect chances
3293 // xinef: skip all calculations, proof: Toxic Tolerance quest
3294 if (spellInfo->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
3295 return SPELL_MISS_NONE;
3296
3297 if (spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_MISS))
3298 {
3299 return SPELL_MISS_NONE;
3300 }
3301
3302 SpellSchoolMask schoolMask = spellInfo->GetSchoolMask();
3303 int32 thisLevel = getLevelForTarget(victim);
3304 if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsTrigger())
3305 thisLevel = std::max<int32>(thisLevel, spellInfo->SpellLevel);
3306 int32 levelDiff = int32(victim->getLevelForTarget(this)) - thisLevel;
3307
3308 int32 MISS_CHANCE_MULTIPLIER;
3309 if (sWorld->getBoolConfig(CONFIG_MISS_CHANCE_MULTIPLIER_ONLY_FOR_PLAYERS) && GetTypeId() != TYPEID_PLAYER) // keep it as it was originally (7 and 11)
3310 {
3311 MISS_CHANCE_MULTIPLIER = victim->GetTypeId() == TYPEID_PLAYER ? 7 : 11;
3312 }
3313 else
3314 {
3315 MISS_CHANCE_MULTIPLIER = sWorld->getRate(
3316 victim->GetTypeId() == TYPEID_PLAYER
3319 }
3320
3321 // Base hit chance from attacker and victim levels
3322 int32 modHitChance = levelDiff < 3
3323 ? 96 - levelDiff
3324 : 94 - (levelDiff - 2) * MISS_CHANCE_MULTIPLIER;
3325
3326 // Spellmod from SPELLMOD_RESIST_MISS_CHANCE
3327 if (Player* modOwner = GetSpellModOwner())
3328 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_RESIST_MISS_CHANCE, modHitChance);
3329
3330 // Increase from attacker SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT auras
3332
3333 // Spells with SPELL_ATTR3_ALWAYS_HIT will ignore target's avoidance effects
3334 // xinef: imo it should completly ignore all calculations, eg: 14792. Hits 80 level players on blizz without any problems
3335 //if (!spell->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
3336 {
3337 // Chance hit from victim SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE auras
3339 // Reduce spell hit chance for Area of effect spells from victim SPELL_AURA_MOD_AOE_AVOIDANCE aura
3340 if (spellInfo->IsAffectingArea())
3341 modHitChance -= victim->GetTotalAuraModifier(SPELL_AURA_MOD_AOE_AVOIDANCE);
3342
3343 // Decrease hit chance from victim rating bonus
3344 if (victim->GetTypeId() == TYPEID_PLAYER)
3345 modHitChance -= int32(victim->ToPlayer()->GetRatingBonusValue(CR_HIT_TAKEN_SPELL));
3346 }
3347
3348 int32 HitChance = modHitChance * 100;
3349 // Increase hit chance from attacker SPELL_AURA_MOD_SPELL_HIT_CHANCE and attacker ratings
3350 // Xinef: Totems should inherit casters ratings?
3351 if (IsTotem())
3352 {
3353 if (Unit* owner = GetOwner())
3354 HitChance += int32(owner->m_modSpellHitChance * 100.0f);
3355 }
3356 else
3357 HitChance += int32(m_modSpellHitChance * 100.0f);
3358
3359 if (HitChance < 100)
3360 HitChance = 100;
3361 else if (HitChance > 10000)
3362 HitChance = 10000;
3363
3364 int32 tmp = 10000 - HitChance;
3365
3366 int32 rand = irand(1, 10000); // Needs to be 1 to 10000 to avoid the 1/10000 chance to miss on 100% hit rating
3367
3368 if (rand < tmp)
3369 return SPELL_MISS_MISS;
3370
3371 // Chance resist mechanic (select max value from every mechanic spell effect)
3372 int32 resist_chance = victim->GetMechanicResistChance(spellInfo) * 100;
3373 tmp += resist_chance;
3374
3375 // Chance resist debuff
3376 if (!spellInfo->IsPositive() && !spellInfo->HasAttribute(SPELL_ATTR4_NO_CAST_LOG))
3377 {
3378 bool bNegativeAura = true;
3379 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3380 {
3381 // Xinef: Check if effect exists!
3382 if (spellInfo->Effects[i].IsEffect() && spellInfo->Effects[i].ApplyAuraName == 0)
3383 {
3384 bNegativeAura = false;
3385 break;
3386 }
3387 }
3388
3389 if (bNegativeAura)
3390 {
3391 tmp += victim->GetMaxPositiveAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, int32(spellInfo->Dispel)) * 100;
3392 tmp += victim->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, int32(spellInfo->Dispel)) * 100;
3393 }
3394
3395 // Players resistance for binary spells
3396 if (spellInfo->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL) && (spellInfo->GetSchoolMask() & (SPELL_SCHOOL_MASK_NORMAL | SPELL_SCHOOL_MASK_HOLY)) == 0)
3397 tmp += int32(Unit::GetEffectiveResistChance(this, spellInfo->GetSchoolMask(), victim) * 10000.0f); // 100 for spell calculations, and 100 for return value percentage
3398 }
3399
3400 // Roll chance
3401 if (rand < tmp)
3402 return SPELL_MISS_RESIST;
3403
3404 // cast by caster in front of victim
3405 if (!victim->HasUnitState(UNIT_STATE_STUNNED) && (victim->HasInArc(M_PI, this) || victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION)))
3406 {
3407 int32 deflect_chance = victim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS) * 100;
3408 tmp += deflect_chance;
3409 if (rand < tmp)
3410 return SPELL_MISS_DEFLECT;
3411 }
3412
3413 return SPELL_MISS_NONE;
3414}
@ CR_HIT_TAKEN_SPELL
Definition: Unit.h:417
@ SPELL_AURA_MOD_DEBUFF_RESISTANCE
Definition: SpellAuraDefines.h:241
@ SPELL_AURA_DEFLECT_SPELLS
Definition: SpellAuraDefines.h:350
@ SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT
Definition: SpellAuraDefines.h:262
@ SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE
Definition: SpellAuraDefines.h:249
@ SPELL_AURA_MOD_AOE_AVOIDANCE
Definition: SpellAuraDefines.h:223
@ SPELLMOD_RESIST_MISS_CHANCE
Definition: SpellDefines.h:93
@ CONFIG_MISS_CHANCE_MULTIPLIER_ONLY_FOR_PLAYERS
Definition: IWorld.h:175
@ RATE_MISS_CHANCE_MULTIPLIER_TARGET_PLAYER
Definition: IWorld.h:508
@ RATE_MISS_CHANCE_MULTIPLIER_TARGET_CREATURE
Definition: IWorld.h:507
@ SPELL_ATTR7_NO_ATTACK_MISS
Definition: SharedDefines.h:638
@ SPELL_MISS_NONE
Definition: SharedDefines.h:1491
@ SPELL_MISS_RESIST
Definition: SharedDefines.h:1493
@ SPELL_MISS_MISS
Definition: SharedDefines.h:1492
@ SPELL_MISS_DEFLECT
Definition: SharedDefines.h:1500
float GetRatingBonusValue(CombatRating cr) const
Definition: Player.cpp:5100
int32 GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
Definition: Unit.cpp:5964
int32 GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
Definition: Unit.cpp:5950
int32 GetMechanicResistChance(SpellInfo const *spell)
Definition: Unit.cpp:3087

References CONFIG_MISS_CHANCE_MULTIPLIER_ONLY_FOR_PLAYERS, CR_HIT_TAKEN_SPELL, SpellInfo::Dispel, SpellInfo::Effects, GetEffectiveResistChance(), getLevelForTarget(), GetMaxNegativeAuraModifierByMiscValue(), GetMaxPositiveAuraModifierByMiscValue(), GetMechanicResistChance(), GetOwner(), Player::GetRatingBonusValue(), SpellInfo::GetSchoolMask(), GetSpellModOwner(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), Object::GetTypeId(), SpellInfo::HasAttribute(), HasAuraType(), Position::HasInArc(), HasUnitState(), SpellInfo::Id, irand(), SpellInfo::IsAffectingArea(), IsAlive(), SpellInfo::IsPositive(), IsTotem(), IsVehicle(), m_modSpellHitChance, MAX_SPELL_EFFECTS, RATE_MISS_CHANCE_MULTIPLIER_TARGET_CREATURE, RATE_MISS_CHANCE_MULTIPLIER_TARGET_PLAYER, SPELL_ATTR0_CU_BINARY_SPELL, SPELL_ATTR3_ALWAYS_HIT, SPELL_ATTR4_NO_CAST_LOG, SPELL_ATTR7_NO_ATTACK_MISS, SPELL_AURA_DEFLECT_SPELLS, SPELL_AURA_IGNORE_HIT_DIRECTION, SPELL_AURA_MOD_AOE_AVOIDANCE, SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE, SPELL_AURA_MOD_DEBUFF_RESISTANCE, SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT, SPELL_MISS_DEFLECT, SPELL_MISS_MISS, SPELL_MISS_NONE, SPELL_MISS_RESIST, SPELL_SCHOOL_MASK_HOLY, SPELL_SCHOOL_MASK_NORMAL, SpellInfo::SpellLevel, SPELLMOD_RESIST_MISS_CHANCE, sWorld, Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, and UNIT_STATE_STUNNED.

Referenced by SpellHitResult().

◆ MeleeDamageBonusDone()

uint32 Unit::MeleeDamageBonusDone ( Unit pVictim,
uint32  damage,
WeaponAttackType  attType,
SpellInfo const *  spellProto = nullptr,
SpellSchoolMask  damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL 
)
12991{
12992 if (!victim || pdamage == 0)
12993 return 0;
12994
12995 if (GetTypeId() == TYPEID_UNIT)
12996 {
12997 // Dancing Rune Weapon...
12998 if (GetEntry() == 27893)
12999 {
13000 if (Unit* owner = GetOwner())
13001 return owner->MeleeDamageBonusDone(victim, pdamage, attType, spellProto, damageSchoolMask) / 2;
13002 }
13003 }
13004
13005 uint32 creatureTypeMask = victim->GetCreatureTypeMask();
13006
13007 // Done fixed damage bonus auras
13008 int32 DoneFlatBenefit = 0;
13009
13010 // ..done
13012 for (AuraEffectList::const_iterator i = mDamageDoneCreature.begin(); i != mDamageDoneCreature.end(); ++i)
13013 if (creatureTypeMask & uint32((*i)->GetMiscValue()))
13014 DoneFlatBenefit += (*i)->GetAmount();
13015
13016 // ..done
13017 // SPELL_AURA_MOD_DAMAGE_DONE included in weapon damage
13018
13019 // ..done (base at attack power for marked target and base at attack power for creature type)
13020 int32 APbonus = 0;
13021
13022 if (attType == RANGED_ATTACK)
13023 {
13024 APbonus += victim->GetTotalAuraModifier(SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS);
13025
13026 // ..done (base at attack power and creature type)
13028 for (AuraEffectList::const_iterator i = mCreatureAttackPower.begin(); i != mCreatureAttackPower.end(); ++i)
13029 if (creatureTypeMask & uint32((*i)->GetMiscValue()))
13030 APbonus += (*i)->GetAmount();
13031 }
13032 else
13033 {
13034 APbonus += victim->GetTotalAuraModifier(SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS);
13035
13036 // ..done (base at attack power and creature type)
13038 for (AuraEffectList::const_iterator i = mCreatureAttackPower.begin(); i != mCreatureAttackPower.end(); ++i)
13039 if (creatureTypeMask & uint32((*i)->GetMiscValue()))
13040 APbonus += (*i)->GetAmount();
13041 }
13042
13043 if (APbonus != 0) // Can be negative
13044 {
13045 bool normalized = false;
13046 if (spellProto)
13047 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
13048 if (spellProto->Effects[i].Effect == SPELL_EFFECT_NORMALIZED_WEAPON_DMG)
13049 {
13050 normalized = true;
13051 break;
13052 }
13053 DoneFlatBenefit += int32(APbonus / 14.0f * GetAPMultiplier(attType, normalized));
13054 }
13055
13056 // Done total percent damage auras
13057 float DoneTotalMod = 1.0f;
13058
13059 // mods for SPELL_SCHOOL_MASK_NORMAL are already factored in base melee damage calculation
13060 if (!(damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL))
13061 {
13062 // Some spells don't benefit from pct done mods
13064 for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
13065 {
13066 if (!spellProto || (spellProto->ValidateAttribute6SpellDamageMods(this, *i, false) &&
13067 sScriptMgr->IsNeedModMeleeDamagePercent(this, *i, DoneTotalMod, spellProto)))
13068 {
13069 if (((*i)->GetMiscValue() & damageSchoolMask))
13070 {
13071 if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
13072 AddPct(DoneTotalMod, (*i)->GetAmount());
13073 else if (!(*i)->GetSpellInfo()->HasAttribute(SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPED_ITEM) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0))
13074 AddPct(DoneTotalMod, (*i)->GetAmount());
13075 else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
13076 AddPct(DoneTotalMod, (*i)->GetAmount());
13077 }
13078 }
13079 }
13080 }
13081
13083 for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i)
13084 if (creatureTypeMask & uint32((*i)->GetMiscValue()))
13085 if (!spellProto || spellProto->ValidateAttribute6SpellDamageMods(this, *i, false))
13086 AddPct(DoneTotalMod, (*i)->GetAmount());
13087
13088 // bonus against aurastate
13090 for (AuraEffectList::const_iterator i = mDamageDoneVersusAurastate.begin(); i != mDamageDoneVersusAurastate.end(); ++i)
13091 if (victim->HasAuraState(AuraStateType((*i)->GetMiscValue())))
13092 if (!spellProto || spellProto->ValidateAttribute6SpellDamageMods(this, *i, false))
13093 AddPct(DoneTotalMod, (*i)->GetAmount());
13094
13095 // done scripted mod (take it from owner)
13096 Unit* owner = GetOwner() ? GetOwner() : this;
13097 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
13098 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
13099 {
13100 if (spellProto && !spellProto->ValidateAttribute6SpellDamageMods(this, *i, false))
13101 continue;
13102
13103 if (!(*i)->IsAffectedOnSpell(spellProto))
13104 continue;
13105
13106 switch ((*i)->GetMiscValue())
13107 {
13108 // Tundra Stalker
13109 // Merciless Combat
13110 case 7277:
13111 {
13112 // Merciless Combat
13113 if ((*i)->GetSpellInfo()->SpellIconID == 2656)
13114 {
13115 if (!victim->HealthAbovePct(35))
13116 AddPct(DoneTotalMod, (*i)->GetAmount());
13117 }
13118 // Tundra Stalker
13119 else
13120 {
13121 // Frost Fever (target debuff)
13122 if (victim->HasAura(55095))
13123 AddPct(DoneTotalMod, (*i)->GetAmount());
13124 }
13125 break;
13126 }
13127 // Rage of Rivendare
13128 case 7293:
13129 {
13130 if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0, 0x02000000, 0))
13131 AddPct(DoneTotalMod, (*i)->GetSpellInfo()->GetRank() * 2.0f);
13132 break;
13133 }
13134 // Marked for Death
13135 case 7598:
13136 case 7599:
13137 case 7600:
13138 case 7601:
13139 case 7602:
13140 {
13141 if (victim->GetAuraEffect(SPELL_AURA_MOD_STALKED, SPELLFAMILY_HUNTER, 0x400, 0, 0))
13142 AddPct(DoneTotalMod, (*i)->GetAmount());
13143 break;
13144 }
13145 // Dirty Deeds
13146 case 6427:
13147 case 6428:
13148 {
13149 if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
13150 {
13151 // effect 0 has expected value but in negative state
13152 int32 bonus = -(*i)->GetBase()->GetEffect(0)->GetAmount();
13153 AddPct(DoneTotalMod, bonus);
13154 }
13155 break;
13156 }
13157 }
13158 }
13159
13160 // Custom scripted damage
13161 if (spellProto)
13162 switch (spellProto->SpellFamilyName)
13163 {
13165 // Glacier Rot
13166 if (spellProto->SpellFamilyFlags[0] & 0x2 || spellProto->SpellFamilyFlags[1] & 0x6)
13168 if (victim->GetDiseasesByCaster(owner->GetGUID()) > 0)
13169 AddPct(DoneTotalMod, aurEff->GetAmount());
13170 break;
13171 }
13172
13173 // Some spells don't benefit from done mods
13174 if (spellProto)
13175 if (spellProto->HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS))
13176 {
13177 DoneFlatBenefit = 0;
13178 DoneTotalMod = 1.0f;
13179 }
13180
13181 float tmpDamage = float(int32(pdamage) + DoneFlatBenefit) * DoneTotalMod;
13182
13183 // apply spellmod to Done damage
13184 if (spellProto)
13185 if (Player* modOwner = GetSpellModOwner())
13186 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_DAMAGE, tmpDamage);
13187
13188 // bonus result can be negative
13189 return uint32(std::max(tmpDamage, 0.0f));
13190}
@ SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS
Definition: SpellAuraDefines.h:165
@ SPELL_AURA_MOD_DAMAGE_DONE_VERSUS
Definition: SpellAuraDefines.h:231
@ SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS
Definition: SpellAuraDefines.h:194
@ SPELL_AURA_MOD_DAMAGE_PERCENT_DONE
Definition: SpellAuraDefines.h:142
@ SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE
Definition: SpellAuraDefines.h:366
@ SPELL_AURA_MOD_DAMAGE_DONE_CREATURE
Definition: SpellAuraDefines.h:122
@ SPELLMOD_DAMAGE
Definition: SpellDefines.h:77
@ SPELL_EFFECT_NORMALIZED_WEAPON_DMG
Definition: SharedDefines.h:871
@ SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPED_ITEM
Definition: SharedDefines.h:555
@ SPELL_ATTR3_IGNORE_CASTER_MODIFIERS
Definition: SharedDefines.h:494
float GetAPMultiplier(WeaponAttackType attType, bool normalized)
Definition: Unit.cpp:17363
AuraEffect * GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
Definition: Unit.h:1976

References AddPct(), AURA_STATE_HEALTHLESS_35_PERCENT, SpellInfo::Effects, GetAPMultiplier(), GetAuraEffect(), GetAuraEffectsByType(), GetCreatureTypeMask(), GetDiseasesByCaster(), GetDummyAuraEffect(), Object::GetEntry(), Object::GetGUID(), GetOwner(), GetSpellModOwner(), GetTotalAuraModifier(), Object::GetTypeId(), SpellInfo::HasAttribute(), HasAura(), HasAuraState(), HealthAbovePct(), SpellInfo::Id, MAX_SPELL_EFFECTS, RANGED_ATTACK, SPELL_ATTR3_IGNORE_CASTER_MODIFIERS, SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPED_ITEM, SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS, SPELL_AURA_MOD_DAMAGE_DONE_CREATURE, SPELL_AURA_MOD_DAMAGE_DONE_VERSUS, SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS, SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS, SPELL_AURA_MOD_STALKED, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS, SPELL_EFFECT_NORMALIZED_WEAPON_DMG, SPELL_SCHOOL_MASK_NORMAL, SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_HUNTER, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SPELLMOD_DAMAGE, sScriptMgr, Object::ToPlayer(), TYPEID_UNIT, and SpellInfo::ValidateAttribute6SpellDamageMods().

Referenced by CalculateMeleeDamage(), and Spell::EffectWeaponDmg().

◆ MeleeDamageBonusTaken()

uint32 Unit::MeleeDamageBonusTaken ( Unit attacker,
uint32  pdamage,
WeaponAttackType  attType,
SpellInfo const *  spellProto = nullptr,
SpellSchoolMask  damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL 
)
13193{
13194 if (pdamage == 0)
13195 return 0;
13196
13197 int32 TakenFlatBenefit = 0;
13198
13199 // ..taken
13201 for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i)
13202 if ((*i)->GetMiscValue() & damageSchoolMask)
13203 TakenFlatBenefit += (*i)->GetAmount();
13204
13205 if (attType != RANGED_ATTACK)
13207 else
13209
13210 // Taken total percent damage auras
13211 float TakenTotalMod = 1.0f;
13212
13214
13215 // .. taken pct (special attacks)
13216 if (spellProto)
13217 {
13218 // From caster spells
13220 for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i)
13221 if ((*i)->GetCasterGUID() == attacker->GetGUID() && (*i)->IsAffectedOnSpell(spellProto))
13222 AddPct(TakenTotalMod, (*i)->GetAmount());
13223
13224 // Mod damage from spell mechanic
13225 uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask();
13226
13227 // Shred, Maul - "Effects which increase Bleed damage also increase Shred damage"
13228 if (spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags[0] & 0x00008800)
13229 mechanicMask |= (1 << MECHANIC_BLEED);
13230
13231 if (mechanicMask)
13232 {
13234 for (AuraEffectList::const_iterator i = mDamageDoneMechanic.begin(); i != mDamageDoneMechanic.end(); ++i)
13235 if (mechanicMask & uint32(1 << ((*i)->GetMiscValue())))
13236 AddPct(TakenTotalMod, (*i)->GetAmount());
13237 }
13238 }
13239
13240 TakenTotalMod = processDummyAuras(TakenTotalMod);
13241
13242 // .. taken pct: class scripts
13243 /*AuraEffectList const& mclassScritAuras = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
13244 for (AuraEffectList::const_iterator i = mclassScritAuras.begin(); i != mclassScritAuras.end(); ++i)
13245 {
13246 switch ((*i)->GetMiscValue())
13247 {
13248 }
13249 }*/
13250
13251 if (attType != RANGED_ATTACK)
13252 {
13254 for (AuraEffectList::const_iterator i = mModMeleeDamageTakenPercent.begin(); i != mModMeleeDamageTakenPercent.end(); ++i)
13255 AddPct(TakenTotalMod, (*i)->GetAmount());
13256 }
13257 else
13258 {
13259 AuraEffectList const& mModRangedDamageTakenPercent = GetAuraEffectsByType(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT);
13260 for (AuraEffectList::const_iterator i = mModRangedDamageTakenPercent.begin(); i != mModRangedDamageTakenPercent.end(); ++i)
13261 AddPct(TakenTotalMod, (*i)->GetAmount());
13262 }
13263
13264 // No positive taken bonus, custom attr
13265 if (spellProto)
13266 if (spellProto->HasAttribute(SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS) && TakenTotalMod > 1.0f)
13267 {
13268 TakenFlatBenefit = 0;
13269 TakenTotalMod = 1.0f;
13270 }
13271
13272 // xinef: sanctified wrath talent
13273 if (TakenTotalMod < 1.0f && attacker->HasAuraType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST))
13274 {
13275 float ignoreModifier = 1.0f - TakenTotalMod;
13276 bool addModifier = false;
13278 for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j)
13279 if ((*j)->GetMiscValue() & damageSchoolMask)
13280 {
13281 ApplyPct(ignoreModifier, (*j)->GetAmount());
13282 addModifier = true;
13283 }
13284
13285 if (addModifier)
13286 TakenTotalMod += ignoreModifier;
13287 }
13288
13289 float tmpDamage = (float(pdamage) + TakenFlatBenefit) * TakenTotalMod;
13290
13291 // bonus result can be negative
13292 return uint32(std::max(tmpDamage, 0.0f));
13293}
@ SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN
Definition: SpellAuraDefines.h:176
@ SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
Definition: SpellAuraDefines.h:150
@ SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN
Definition: SpellAuraDefines.h:188
@ SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT
Definition: SpellAuraDefines.h:189
@ SPELL_AURA_MOD_DAMAGE_TAKEN
Definition: SpellAuraDefines.h:77
@ SPELL_AURA_MOD_DAMAGE_FROM_CASTER
Definition: SpellAuraDefines.h:334
@ SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT
Definition: SpellAuraDefines.h:318
@ SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT
Definition: SpellAuraDefines.h:177
@ SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS
Definition: SpellInfo.h:197
float processDummyAuras(float TakenTotalMod) const
Definition: Unit.cpp:11825

References AddPct(), ApplyPct(), SpellInfo::GetAllEffectsMechanicMask(), GetAuraEffectsByType(), Object::GetGUID(), GetTotalAuraModifier(), GetTotalAuraMultiplierByMiscMask(), SpellInfo::HasAttribute(), HasAuraType(), MECHANIC_BLEED, processDummyAuras(), RANGED_ATTACK, SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS, SPELL_AURA_MOD_DAMAGE_FROM_CASTER, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, SPELL_AURA_MOD_DAMAGE_TAKEN, SPELL_AURA_MOD_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT, SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN, SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT, SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN, SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT, SPELLFAMILY_DRUID, SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

Referenced by CalculateMeleeDamage(), and Spell::EffectWeaponDmg().

◆ MeleeSpellHitResult()

SpellMissInfo Unit::MeleeSpellHitResult ( Unit victim,
SpellInfo const *  spell 
)
3109{
3110 // Spells with SPELL_ATTR3_ALWAYS_HIT will additionally fully ignore
3111 // resist and deflect chances
3112 if (spellInfo->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
3113 return SPELL_MISS_NONE;
3114
3115 WeaponAttackType attType = BASE_ATTACK;
3116
3117 // Check damage class instead of attack type to correctly handle judgements
3118 // - they are meele, but can't be dodged/parried/deflected because of ranged dmg class
3119 if (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED)
3120 attType = RANGED_ATTACK;
3121
3122 int32 attackerWeaponSkill;
3123 // skill value for these spells (for example judgements) is 5* level
3124 if (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED && !spellInfo->IsRangedWeaponSpell())
3125 attackerWeaponSkill = GetLevel() * 5;
3126 // bonus from skills is 0.04% per skill Diff
3127 else
3128 attackerWeaponSkill = int32(GetWeaponSkillValue(attType, victim));
3129
3130 int32 skillDiff = attackerWeaponSkill - int32(victim->GetMaxSkillValueForLevel(this));
3131
3132 uint32 roll = urand (0, 10000);
3133
3134 uint32 missChance = uint32(MeleeSpellMissChance(victim, attType, skillDiff, spellInfo->Id) * 100.0f);
3135 // Roll miss
3136 uint32 tmp = missChance;
3137 if (roll < tmp)
3138 return SPELL_MISS_MISS;
3139
3140 bool canDodge = !spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_DODGE);
3141 bool canParry = !spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_PARRY);
3142 bool canBlock = spellInfo->HasAttribute(SPELL_ATTR3_COMPLETELY_BLOCKED) && !spellInfo->HasAttribute(SPELL_ATTR0_CU_DIRECT_DAMAGE);
3143
3144 // Same spells cannot be parry/dodge
3145 if (spellInfo->HasAttribute(SPELL_ATTR0_NO_ACTIVE_DEFENSE))
3146 return SPELL_MISS_NONE;
3147
3148 // Chance resist mechanic
3149 int32 resist_chance = victim->GetMechanicResistChance(spellInfo) * 100;
3150 tmp += resist_chance;
3151 if (roll < tmp)
3152 return SPELL_MISS_RESIST;
3153
3154 // Ranged attacks can only miss, resist and deflect
3155 if (attType == RANGED_ATTACK)
3156 {
3157 // only if in front
3158 if (!victim->HasUnitState(UNIT_STATE_STUNNED) && (victim->HasInArc(M_PI, this) || victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION)))
3159 {
3160 int32 deflect_chance = victim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS) * 100;
3161 tmp += deflect_chance;
3162 if (roll < tmp)
3163 return SPELL_MISS_DEFLECT;
3164 }
3165
3166 canDodge = false;
3167 canParry = false;
3168 }
3169
3170 // Check for attack from behind
3171 // xinef: if from behind or spell requires cast from behind
3172 if (!victim->HasInArc(M_PI, this))
3173 {
3175 {
3176 // Can`t dodge from behind in PvP (but its possible in PvE)
3177 if (victim->GetTypeId() == TYPEID_PLAYER)
3178 {
3179 canDodge = false;
3180 }
3181
3182 // Can`t parry or block
3183 canParry = false;
3184 canBlock = false;
3185 }
3186 }
3187
3188 // Check creatures flags_extra for disable parry
3189 if (victim->GetTypeId() == TYPEID_UNIT)
3190 {
3191 uint32 flagEx = victim->ToCreature()->GetCreatureTemplate()->flags_extra;
3192 // Xinef: no dodge flag
3193 if (flagEx & CREATURE_FLAG_EXTRA_NO_DODGE)
3194 canDodge = false;
3195 if (flagEx & CREATURE_FLAG_EXTRA_NO_PARRY)
3196 canParry = false;
3197 // Check creatures flags_extra for disable block
3198 if (flagEx & CREATURE_FLAG_EXTRA_NO_BLOCK)
3199 canBlock = false;
3200 }
3201 // Ignore combat result aura
3203 for (AuraEffectList::const_iterator i = ignore.begin(); i != ignore.end(); ++i)
3204 {
3205 if (!(*i)->IsAffectedOnSpell(spellInfo))
3206 continue;
3207 switch ((*i)->GetMiscValue())
3208 {
3209 case MELEE_HIT_DODGE:
3210 canDodge = false;
3211 break;
3212 case MELEE_HIT_BLOCK:
3213 canBlock = false;
3214 break;
3215 case MELEE_HIT_PARRY:
3216 canParry = false;
3217 break;
3218 default:
3219 LOG_DEBUG("entities.unit", "Spell {} SPELL_AURA_IGNORE_COMBAT_RESULT has unhandled state {}", (*i)->GetId(), (*i)->GetMiscValue());
3220 break;
3221 }
3222 }
3223
3224 if (canDodge)
3225 {
3226 // Roll dodge
3227 int32 dodgeChance = int32(victim->GetUnitDodgeChance() * 100.0f) - skillDiff * 4;
3228 // Reduce enemy dodge chance by SPELL_AURA_MOD_COMBAT_RESULT_CHANCE
3230 dodgeChance = int32(float(dodgeChance) * GetTotalAuraMultiplier(SPELL_AURA_MOD_ENEMY_DODGE));
3231 // Reduce dodge chance by attacker expertise rating
3232 if (GetTypeId() == TYPEID_PLAYER)
3233 dodgeChance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100.0f);
3234 else
3236
3237 // xinef: cant dodge while casting or while stunned
3238 if (dodgeChance < 0 || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3239 dodgeChance = 0;
3240
3241 tmp += dodgeChance;
3242 if (roll < tmp)
3243 return SPELL_MISS_DODGE;
3244 }
3245
3246 if (canParry)
3247 {
3248 // Roll parry
3249 int32 parryChance = int32(victim->GetUnitParryChance() * 100.0f) - skillDiff * 4;
3250 // Reduce parry chance by attacker expertise rating
3251 if (GetTypeId() == TYPEID_PLAYER)
3252 parryChance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100.0f);
3253 else
3255
3256 // xinef: cant parry while casting or while stunned
3257 if (parryChance < 0 || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3258 parryChance = 0;
3259
3260 tmp += parryChance;
3261 if (roll < tmp)
3262 return SPELL_MISS_PARRY;
3263 }
3264
3265 if (canBlock)
3266 {
3267 int32 blockChance = int32(victim->GetUnitBlockChance() * 100.0f) - skillDiff * 4;
3268
3269 // xinef: cant block while casting or while stunned
3270 if (blockChance < 0 || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3271 blockChance = 0;
3272
3273 tmp += blockChance;
3274 if (roll < tmp)
3275 return SPELL_MISS_BLOCK;
3276 }
3277
3278 return SPELL_MISS_NONE;
3279}
@ CREATURE_FLAG_EXTRA_NO_PARRY
Definition: CreatureData.h:51
@ CREATURE_FLAG_EXTRA_NO_DODGE
Definition: CreatureData.h:72
@ SPELL_AURA_MOD_EXPERTISE
Definition: SpellAuraDefines.h:303
@ SPELL_AURA_IGNORE_COMBAT_RESULT
Definition: SpellAuraDefines.h:265
@ SPELL_AURA_MOD_ENEMY_DODGE
Definition: SpellAuraDefines.h:314
@ SPELL_AURA_MOD_COMBAT_RESULT_CHANCE
Definition: SpellAuraDefines.h:311
@ SPELL_ATTR0_CU_DIRECT_DAMAGE
Definition: SpellInfo.h:184
@ SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET
Definition: SpellInfo.h:193
@ SPELL_ATTR7_NO_ATTACK_PARRY
Definition: SharedDefines.h:637
@ SPELL_ATTR7_NO_ATTACK_DODGE
Definition: SharedDefines.h:636
@ SPELL_ATTR3_COMPLETELY_BLOCKED
Definition: SharedDefines.h:468
@ SPELL_MISS_PARRY
Definition: SharedDefines.h:1495
@ SPELL_MISS_DODGE
Definition: SharedDefines.h:1494
@ SPELL_MISS_BLOCK
Definition: SharedDefines.h:1496
float GetUnitDodgeChance() const
Definition: Unit.cpp:3593
float GetTotalAuraMultiplier(AuraType auratype) const
Definition: Unit.cpp:5836
float GetUnitParryChance() const
Definition: Unit.cpp:3610
float MeleeSpellMissChance(Unit const *victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
Definition: Unit.cpp:19126

References BASE_ATTACK, CREATURE_FLAG_EXTRA_NO_BLOCK, CREATURE_FLAG_EXTRA_NO_DODGE, CREATURE_FLAG_EXTRA_NO_PARRY, SpellInfo::DmgClass, CreatureTemplate::flags_extra, GetAuraEffectsByType(), Creature::GetCreatureTemplate(), GetLevel(), GetMaxSkillValueForLevel(), GetMechanicResistChance(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscValue(), GetTotalAuraMultiplier(), Object::GetTypeId(), GetUnitBlockChance(), GetUnitDodgeChance(), GetUnitParryChance(), GetWeaponSkillValue(), SpellInfo::HasAttribute(), HasAuraType(), Position::HasInArc(), HasUnitState(), SpellInfo::Id, IsNonMeleeSpellCast(), SpellInfo::IsRangedWeaponSpell(), LOG_DEBUG, MELEE_HIT_BLOCK, MELEE_HIT_DODGE, MELEE_HIT_PARRY, MeleeSpellMissChance(), RANGED_ATTACK, SPELL_ATTR0_CU_DIRECT_DAMAGE, SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET, SPELL_ATTR0_NO_ACTIVE_DEFENSE, SPELL_ATTR3_ALWAYS_HIT, SPELL_ATTR3_COMPLETELY_BLOCKED, SPELL_ATTR7_NO_ATTACK_DODGE, SPELL_ATTR7_NO_ATTACK_PARRY, SPELL_AURA_DEFLECT_SPELLS, SPELL_AURA_IGNORE_COMBAT_RESULT, SPELL_AURA_IGNORE_HIT_DIRECTION, SPELL_AURA_MOD_COMBAT_RESULT_CHANCE, SPELL_AURA_MOD_ENEMY_DODGE, SPELL_AURA_MOD_EXPERTISE, SPELL_DAMAGE_CLASS_RANGED, SPELL_MISS_BLOCK, SPELL_MISS_DEFLECT, SPELL_MISS_DODGE, SPELL_MISS_MISS, SPELL_MISS_NONE, SPELL_MISS_PARRY, SPELL_MISS_RESIST, Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, UNIT_STATE_CONTROLLED, UNIT_STATE_STUNNED, urand(), and VICTIMSTATE_DODGE.

Referenced by SpellHitResult().

◆ MeleeSpellMissChance()

float Unit::MeleeSpellMissChance ( Unit const *  victim,
WeaponAttackType  attType,
int32  skillDiff,
uint32  spellId 
) const
19127{
19128 SpellInfo const* spellInfo = spellId ? sSpellMgr->GetSpellInfo(spellId) : nullptr;
19129 if (spellInfo && spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_MISS))
19130 {
19131 return 0.0f;
19132 }
19133
19134 //calculate miss chance
19135 float missChance = victim->GetUnitMissChance(attType);
19136
19137 // Check if dual wielding, add additional miss penalty - when mainhand has on next swing spell, offhand doesnt suffer penalty
19138 if (!spellId && (attType != RANGED_ATTACK) && haveOffhandWeapon() && (!m_currentSpells[CURRENT_MELEE_SPELL] || !m_currentSpells[CURRENT_MELEE_SPELL]->IsNextMeleeSwingSpell()))
19139 {
19140 missChance += 19;
19141 }
19142
19143 // bonus from skills is 0.04%
19144 //miss_chance -= skillDiff * 0.04f;
19145 int32 diff = -skillDiff;
19146 if (victim->GetTypeId() == TYPEID_PLAYER)
19147 missChance += diff > 0 ? diff * 0.04f : diff * 0.02f;
19148 else
19149 missChance += diff > 10 ? 1 + (diff - 10) * 0.4f : diff * 0.1f;
19150
19151 // Calculate hit chance
19152 float hitChance = 100.0f;
19153
19154 // Spellmod from SPELLMOD_RESIST_MISS_CHANCE
19155 if (spellId)
19156 {
19157 if (Player* modOwner = GetSpellModOwner())
19158 modOwner->ApplySpellMod(spellId, SPELLMOD_RESIST_MISS_CHANCE, hitChance);
19159 }
19160
19161 missChance += hitChance - 100.0f;
19162
19163 if (attType == RANGED_ATTACK)
19164 missChance -= m_modRangedHitChance;
19165 else
19166 missChance -= m_modMeleeHitChance;
19167
19168 // Limit miss chance from 0 to 60%
19169 if (missChance < 0.0f)
19170 return 0.0f;
19171 if (missChance > 60.0f)
19172 return 60.0f;
19173 return missChance;
19174}

References CURRENT_MELEE_SPELL, GetSpellModOwner(), Object::GetTypeId(), GetUnitMissChance(), SpellInfo::HasAttribute(), haveOffhandWeapon(), m_currentSpells, m_modMeleeHitChance, m_modRangedHitChance, RANGED_ATTACK, SPELL_ATTR7_NO_ATTACK_MISS, SPELLMOD_RESIST_MISS_CHANCE, sSpellMgr, and TYPEID_PLAYER.

Referenced by MeleeSpellHitResult(), and RollMeleeOutcomeAgainst().

◆ ModifyAuraState()

void Unit::ModifyAuraState ( AuraStateType  flag,
bool  apply 
)
10458{
10459 if (apply)
10460 {
10461 if (!HasFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1)))
10462 {
10463 SetFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1));
10464 Unit::AuraMap& tAuras = GetOwnedAuras();
10465 for (Unit::AuraMap::iterator itr = tAuras.begin(); itr != tAuras.end(); ++itr)
10466 {
10467 if( (*itr).second->IsRemoved() )
10468 continue;
10469
10470 if( (*itr).second->GetSpellInfo()->CasterAuraState == flag )
10471 if( AuraApplication* aurApp = (*itr).second->GetApplicationOfTarget(GetGUID()) )
10472 (*itr).second->HandleAllEffects(aurApp, AURA_EFFECT_HANDLE_REAL, true);
10473 }
10474 }
10475 }
10476 else
10477 {
10478 if (HasFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1)))
10479 {
10480 RemoveFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1));
10481
10482 if (flag != AURA_STATE_ENRAGE) // enrage aura state triggering continues auras
10483 {
10484 Unit::AuraMap& tAuras = GetOwnedAuras();
10485 for (Unit::AuraMap::iterator itr = tAuras.begin(); itr != tAuras.end(); ++itr)
10486 {
10487 if( (*itr).second->GetSpellInfo()->CasterAuraState == flag )
10488 if( AuraApplication* aurApp = (*itr).second->GetApplicationOfTarget(GetGUID()) )
10489 (*itr).second->HandleAllEffects(aurApp, AURA_EFFECT_HANDLE_REAL, false);
10490 }
10491 }
10492 }
10493 }
10494}
@ AURA_EFFECT_HANDLE_REAL
Definition: SpellAuraDefines.h:42
@ AURA_STATE_ENRAGE
Definition: SharedDefines.h:1281
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:845
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:860
std::multimap< uint32, Aura * > AuraMap
Definition: Unit.h:1295
AuraMap & GetOwnedAuras()
Definition: Unit.h:1914

References AURA_EFFECT_HANDLE_REAL, AURA_STATE_ENRAGE, Object::GetGUID(), GetOwnedAuras(), Object::HasFlag(), Object::RemoveFlag(), Object::SetFlag(), and UNIT_FIELD_AURASTATE.

Referenced by _ApplyAura(), _UnapplyAura(), ClearAllReactives(), ConflagrateAuraStateDelayEvent::Execute(), Spell::finish(), debug_commandscript::HandleDebugSetAuraStateCommand(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), ProcDamageAndSpellFor(), Update(), and UpdateReactives().

◆ ModifyHealth()

int32 Unit::ModifyHealth ( int32  val)
13999{
14000 int32 gain = 0;
14001
14002 if (dVal == 0)
14003 return 0;
14004
14005 int32 curHealth = (int32)GetHealth();
14006
14007 int32 val = dVal + curHealth;
14008 if (val <= 0)
14009 {
14010 SetHealth(0);
14011 return -curHealth;
14012 }
14013
14014 int32 maxHealth = (int32)GetMaxHealth();
14015
14016 if (val < maxHealth)
14017 {
14018 SetHealth(val);
14019 gain = val - curHealth;
14020 }
14021 else if (curHealth != maxHealth)
14022 {
14023 SetHealth(maxHealth);
14024 gain = maxHealth - curHealth;
14025 }
14026
14027 return gain;
14028}

References GetHealth(), GetMaxHealth(), and SetHealth().

Referenced by DealDamage(), DealHeal(), boss_xt002::boss_xt002AI::DoAction(), boss_ichoron::boss_ichoronAI::DoAction(), AuraEffect::HandleAuraModIncreaseHealth(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), boss_hadronox::boss_hadronoxAI::KilledUnit(), boss_gluth::boss_gluthAI::KilledUnit(), Creature::RegenerateHealth(), Player::RegenerateHealth(), Spell::TakePower(), Aura::Update(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_voidtraveler::npc_voidtravelerAI::UpdateAI(), and npc_injured_patient::npc_injured_patientAI::UpdateAI().

◆ ModifyPower()

int32 Unit::ModifyPower ( Powers  power,
int32  val,
bool  withPowerUpdate = true 
)
14057{
14058 if (dVal == 0)
14059 return 0;
14060
14061 int32 gain = 0;
14062
14063 int32 curPower = (int32)GetPower(power);
14064
14065 int32 val = dVal + curPower;
14066 if (val <= 0)
14067 {
14068 SetPower(power, 0, withPowerUpdate);
14069 return -curPower;
14070 }
14071
14072 int32 maxPower = (int32)GetMaxPower(power);
14073
14074 if (val < maxPower)
14075 {
14076 SetPower(power, val, withPowerUpdate);
14077 gain = val - curPower;
14078 }
14079 else if (curPower != maxPower)
14080 {
14081 SetPower(power, maxPower, withPowerUpdate);
14082 gain = maxPower - curPower;
14083 }
14084
14085 return gain;
14086}
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition: Unit.cpp:15453

References GetMaxPower(), GetPower(), and SetPower().

Referenced by CalcAbsorbResist(), Spell::EffectPowerBurn(), Spell::EffectPowerDrain(), Spell::EffectSchoolDMG(), EnergizeBySpell(), AuraEffect::HandleObsModPowerAuraTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_kelthuzad_detonate_mana::spell_kelthuzad_detonate_mana_AuraScript::HandleScript(), Pet::LoseHappiness(), ModifyPowerPct(), Creature::Regenerate(), RewardRage(), Pet::setDeathState(), Spell::TakePower(), Spell::TakeRunePower(), Aura::Update(), boss_curator::boss_curatorAI::UpdateAI(), boss_faction_championsAI::UpdateAI(), and boss_pathaleon_the_calculator::boss_pathaleon_the_calculatorAI::UpdateAI().

◆ ModifyPowerPct()

int32 Unit::ModifyPowerPct ( Powers  power,
float  pct,
bool  apply = true 
)
14090{
14091 float amount = (float)GetMaxPower(power);
14092 ApplyPercentModFloatVar(amount, pct, apply);
14093
14094 return ModifyPower(power, (int32)amount - (int32)GetMaxPower(power));
14095}

References ApplyPercentModFloatVar(), GetMaxPower(), and ModifyPower().

Referenced by AuraEffect::HandleAuraModIncreaseEnergyPercent().

◆ ModifyRedirectThreat()

void Unit::ModifyRedirectThreat ( int32  amount)
inline
void ModifyThreatPct(int32 amount)
Definition: Unit.h:962

References _redirectThreatInfo, and RedirectThreatInfo::ModifyThreatPct().

Referenced by spell_warr_vigilance::HandleAfterApply().

◆ ModSpellCastTime()

void Unit::ModSpellCastTime ( SpellInfo const *  spellProto,
int32 castTime,
Spell spell = nullptr 
)
14861{
14862 if (!spellInfo || castTime < 0)
14863 return;
14864
14865 if (spellInfo->IsChanneled() && spellInfo->HasAura(SPELL_AURA_MOUNTED))
14866 return;
14867
14868 // called from caster
14869 if (Player* modOwner = GetSpellModOwner())
14870 // TODO:(MadAgos) Eventually check and delete the bool argument
14871 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CASTING_TIME, castTime, spell, bool(modOwner != this && !IsPet()));
14872
14873 switch (spellInfo->DmgClass)
14874 {
14876 if (spellInfo->AttributesEx5 & SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC) // required double check
14877 castTime = int32(float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED));
14878 else if (spellInfo->SpellVisual[0] == 3881 && HasAura(67556)) // cooking with Chef Hat.
14879 castTime = 500;
14880 break;
14882 break; // no known cases
14884 castTime = CanInstantCast() ? 0 : int32(float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED));
14885 break;
14887 castTime = int32(float(castTime) * m_modAttackSpeedPct[RANGED_ATTACK]);
14888 break;
14889 default:
14890 break;
14891 }
14892}
@ SPELLMOD_CASTING_TIME
Definition: SpellDefines.h:87
@ SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC
Definition: SharedDefines.h:552
bool CanInstantCast() const
Definition: Unit.h:2437

References SpellInfo::AttributesEx5, CanInstantCast(), SpellInfo::DmgClass, Object::GetFloatValue(), GetSpellModOwner(), SpellInfo::HasAura(), HasAura(), SpellInfo::Id, SpellInfo::IsChanneled(), IsPet(), m_modAttackSpeedPct, RANGED_ATTACK, SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC, SPELL_AURA_MOUNTED, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELLMOD_CASTING_TIME, SpellInfo::SpellVisual, and UNIT_MOD_CAST_SPEED.

Referenced by SpellInfo::CalcCastTime().

◆ ModSpellDuration()

int32 Unit::ModSpellDuration ( SpellInfo const *  spellProto,
Unit const *  target,
int32  duration,
bool  positive,
uint32  effectMask 
)
14761{
14762 // don't mod permanent auras duration
14763 if (duration < 0)
14764 return duration;
14765
14766 // some auras are not affected by duration modifiers
14767 if (spellProto->HasAttribute(SPELL_ATTR7_NO_TARGET_DURATION_MOD))
14768 return duration;
14769
14770 // cut duration only of negative effects
14771 // xinef: also calculate self casts, spell can be reflected for example
14772 if (!positive)
14773 {
14774 int32 mechanic = spellProto->GetSpellMechanicMaskByEffectMask(effectMask);
14775
14776 int32 durationMod;
14777 int32 durationMod_always = 0;
14778 int32 durationMod_not_stack = 0;
14779
14780 for (uint8 i = 1; i <= MECHANIC_ENRAGED; ++i)
14781 {
14782 if (!(mechanic & 1 << i))
14783 continue;
14784
14785 // Xinef: spells affecting movement imparing effects should not reduce duration if disoriented mechanic is present
14786 if (i == MECHANIC_SNARE && (mechanic & (1 << MECHANIC_DISORIENTED)))
14787 continue;
14788
14789 // Find total mod value (negative bonus)
14790 int32 new_durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD, i);
14791 // Find max mod (negative bonus)
14792 int32 new_durationMod_not_stack = target->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK, i);
14793 // Check if mods applied before were weaker
14794 if (new_durationMod_always < durationMod_always)
14795 durationMod_always = new_durationMod_always;
14796 if (new_durationMod_not_stack < durationMod_not_stack)
14797 durationMod_not_stack = new_durationMod_not_stack;
14798 }
14799
14800 // Select strongest negative mod
14801 if (durationMod_always > durationMod_not_stack)
14802 durationMod = durationMod_not_stack;
14803 else
14804 durationMod = durationMod_always;
14805
14806 if (durationMod != 0)
14807 AddPct(duration, durationMod);
14808
14809 // there are only negative mods currently
14810 durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL, spellProto->Dispel);
14811 durationMod_not_stack = target->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK, spellProto->Dispel);
14812
14813 durationMod = 0;
14814 if (durationMod_always > durationMod_not_stack)
14815 durationMod += durationMod_not_stack;
14816 else
14817 durationMod += durationMod_always;
14818
14819 if (durationMod != 0)
14820 AddPct(duration, durationMod);
14821 }
14822 else
14823 {
14824 // else positive mods here, there are no currently
14825 // when there will be, change GetTotalAuraModifierByMiscValue to GetTotalPositiveAuraModifierByMiscValue
14826 }
14827
14828 // Glyphs which increase duration of selfcasted buffs
14829 if (target == this)
14830 {
14831 switch (spellProto->SpellFamilyName)
14832 {
14833 case SPELLFAMILY_DRUID:
14834 if (spellProto->SpellFamilyFlags[0] & 0x100)
14835 {
14836 // Glyph of Thorns
14837 if (AuraEffect* aurEff = GetAuraEffect(57862, 0))
14838 duration += aurEff->GetAmount() * MINUTE * IN_MILLISECONDS;
14839 }
14840 break;
14842 if ((spellProto->SpellFamilyFlags[0] & 0x00000002) && spellProto->SpellIconID == 298)
14843 {
14844 // Glyph of Blessing of Might
14845 if (AuraEffect* aurEff = GetAuraEffect(57958, 0))
14846 duration += aurEff->GetAmount() * MINUTE * IN_MILLISECONDS;
14847 }
14848 else if ((spellProto->SpellFamilyFlags[0] & 0x00010000) && spellProto->SpellIconID == 306)
14849 {
14850 // Glyph of Blessing of Wisdom
14851 if (AuraEffect* aurEff = GetAuraEffect(57979, 0))
14852 duration += aurEff->GetAmount() * MINUTE * IN_MILLISECONDS;
14853 }
14854 break;
14855 }
14856 }
14857 return std::max(duration, 0);
14858}
constexpr auto MINUTE
Definition: Common.h:56
@ SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK
Definition: SpellAuraDefines.h:309
@ SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK
Definition: SpellAuraDefines.h:297
@ SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL
Definition: SpellAuraDefines.h:308
@ SPELL_AURA_MECHANIC_DURATION_MOD
Definition: SpellAuraDefines.h:295
@ SPELL_ATTR7_NO_TARGET_DURATION_MOD
Definition: SharedDefines.h:614
@ MECHANIC_ENRAGED
Definition: SharedDefines.h:1328
@ MECHANIC_DISORIENTED
Definition: SharedDefines.h:1299

References AddPct(), SpellInfo::Dispel, GetAuraEffect(), GetMaxNegativeAuraModifierByMiscValue(), SpellInfo::GetSpellMechanicMaskByEffectMask(), GetTotalAuraModifierByMiscValue(), SpellInfo::HasAttribute(), IN_MILLISECONDS, MECHANIC_DISORIENTED, MECHANIC_ENRAGED, MECHANIC_SNARE, MINUTE, SPELL_ATTR7_NO_TARGET_DURATION_MOD, SPELL_AURA_MECHANIC_DURATION_MOD, SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK, SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL, SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK, SPELLFAMILY_DRUID, SPELLFAMILY_PALADIN, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, and SpellInfo::SpellIconID.

Referenced by Spell::DoSpellHitOnUnit(), and Spell::EffectInterruptCast().

◆ MonsterMoveWithSpeed()

◆ Mount()

void Unit::Mount ( uint32  mount,
uint32  vehicleId = 0,
uint32  creatureEntry = 0 
)
13382{
13383 if (mount)
13385
13387
13388 if (Player* player = ToPlayer())
13389 {
13390 sScriptMgr->AnticheatSetUnderACKmount(player);
13391
13392 // mount as a vehicle
13393 if (VehicleId)
13394 {
13395 if (CreateVehicleKit(VehicleId, creatureEntry))
13396 {
13397 GetVehicleKit()->Reset();
13398
13399 // Send others that we now have a vehicle
13401 data << GetPackGUID();
13402 data << uint32(VehicleId);
13403 SendMessageToSet(&data, true);
13404
13406 player->GetSession()->SendPacket(&data);
13407
13408 // mounts can also have accessories
13410 }
13411 }
13412
13413 // unsummon pet
13414 Pet* pet = player->GetPet();
13415 if (pet)
13416 {
13418 // don't unsummon pet in arena but SetFlag UNIT_FLAG_STUNNED to disable pet's interface
13419 if (bg && bg->isArena())
13421 else
13422 player->UnsummonPetTemporaryIfAny();
13423 }
13424
13425 // xinef: if we have charmed npc, stun him also
13426 if (Unit* charm = player->GetCharm())
13427 if (charm->GetTypeId() == TYPEID_UNIT)
13428 charm->SetUnitFlag(UNIT_FLAG_STUNNED);
13429
13430 WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
13431 data << GetPackGUID();
13432 data << uint32(GameTime::GetGameTime().count()); // Packet counter
13433 data << player->GetCollisionHeight();
13434 player->GetSession()->SendPacket(&data);
13435 }
13436
13438}
@ AURA_INTERRUPT_FLAG_MOUNT
Definition: SpellDefines.h:61
bool isArena() const
Definition: Battleground.h:388
bool CreateVehicleKit(uint32 id, uint32 creatureEntry)
Definition: Unit.cpp:18853
void Reset(bool evading=false)
Definition: Vehicle.cpp:118
void InstallAllAccessories(bool evading)
Definition: Vehicle.cpp:85

References AURA_INTERRUPT_FLAG_MOUNT, CreateVehicleKit(), Player::GetBattleground(), GetCharm(), GameTime::GetGameTime(), Object::GetPackGUID(), GetVehicleKit(), WorldPacket::Initialize(), Vehicle::InstallAllAccessories(), Battleground::isArena(), RemoveAurasWithInterruptFlags(), Vehicle::Reset(), WorldObject::SendMessageToSet(), Object::SetUInt32Value(), SetUnitFlag(), SMSG_MOVE_SET_COLLISION_HGT, SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, SMSG_PLAYER_VEHICLE_DATA, sScriptMgr, Object::ToPlayer(), TYPEID_UNIT, UNIT_FIELD_MOUNTDISPLAYID, UNIT_FLAG_MOUNT, and UNIT_FLAG_STUNNED.

Referenced by AuraEffect::HandleAuraMounted(), spell_mount_check::spell_mount_check_AuraScript::HandleEffectPeriodic(), modify_commandscript::HandleModifyMountCommand(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::InitializeAI(), boss_captain_skarloc::boss_captain_skarlocAI::InitializeAI(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::JustRespawned(), Creature::LoadCreaturesAddon(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::MountSelf(), npc_scarlet_courier::npc_scarlet_courierAI::Reset(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), boss_mandokir::boss_mandokirAI::Reset(), WorldSession::SendDoFlight(), and npc_koltira_deathweaver::npc_koltira_deathweaverAI::WaypointReached().

◆ NearTeleportTo() [1/2]

void Unit::NearTeleportTo ( float  x,
float  y,
float  z,
float  orientation,
bool  casting = false,
bool  vehicleTeleport = false,
bool  withPet = false,
bool  removeTransport = false 
)
20112{
20113 DisableSpline();
20114 if (GetTypeId() == TYPEID_PLAYER)
20115 ToPlayer()->TeleportTo(GetMapId(), x, y, z, orientation, TELE_TO_NOT_LEAVE_COMBAT | (removeTransport ? 0 : TELE_TO_NOT_LEAVE_TRANSPORT) | TELE_TO_NOT_UNSUMMON_PET | (casting ? TELE_TO_SPELL : 0) | (vehicleTeleport ? TELE_TO_NOT_LEAVE_VEHICLE : 0) | (withPet ? TELE_TO_WITH_PET : 0));
20116 else
20117 {
20118 Position pos = {x, y, z, orientation};
20119 SendTeleportPacket(pos);
20120 UpdatePosition(x, y, z, orientation, true);
20123 }
20124}
@ TELE_TO_WITH_PET
Definition: Player.h:820
@ TELE_TO_NOT_LEAVE_VEHICLE
Definition: Player.h:819
@ TELE_TO_SPELL
Definition: Player.h:818
@ TELE_TO_NOT_LEAVE_COMBAT
Definition: Player.h:816
@ TELE_TO_NOT_UNSUMMON_PET
Definition: Player.h:817
@ TELE_TO_NOT_LEAVE_TRANSPORT
Definition: Player.h:815
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0, Unit *target=nullptr, bool newInstance=false)
Definition: Player.cpp:1311
void SendTeleportPacket(Position &pos)
Definition: Unit.cpp:20133
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition: Unit.cpp:19268
virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport=false)
Definition: Unit.cpp:20152
void ReinitializeMovement()
Definition: MotionMaster.cpp:808

References DisableSpline(), WorldLocation::GetMapId(), GetMotionMaster(), Object::GetTypeId(), MotionMaster::ReinitializeMovement(), SendTeleportPacket(), TELE_TO_NOT_LEAVE_COMBAT, TELE_TO_NOT_LEAVE_TRANSPORT, TELE_TO_NOT_LEAVE_VEHICLE, TELE_TO_NOT_UNSUMMON_PET, TELE_TO_SPELL, TELE_TO_WITH_PET, Player::TeleportTo(), Object::ToPlayer(), TYPEID_PLAYER, UpdateObjectVisibility(), and UpdatePosition().

◆ NearTeleportTo() [2/2]

void Unit::NearTeleportTo ( Position pos,
bool  casting = false,
bool  vehicleTeleport = false,
bool  withPet = false,
bool  removeTransport = false 
)
20107{
20108 NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), casting, vehicleTeleport, withPet, removeTransport);
20109}
void NearTeleportTo(Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
Definition: Unit.cpp:20106

References Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), and NearTeleportTo().

Referenced by boss_viscidus::DamageTaken(), npc_madrigosa::npc_madrigosaAI::DoAction(), Spell::EffectLeap(), Spell::EffectResurrectPet(), Spell::EffectStuck(), Spell::EffectSummonPet(), Spell::EffectTeleportUnits(), Spell::EffectTeleUnitsFaceCaster(), boss_jeklik::EnterEvadeMode(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::EnterEvadeMode(), boss_zuljin::boss_zuljinAI::EnterPhase(), UtherBatteredHiltEvent::Execute(), BattlegroundBE::HandleAreaTrigger(), BattlegroundDS::HandleAreaTrigger(), BattlegroundNA::HandleAreaTrigger(), BattlegroundRL::HandleAreaTrigger(), BattlegroundRV::HandleAreaTrigger(), spell_moroes_vanish::spell_moroes_vanish_SpellScript::HandleDummy(), spell_class_call_handler::HandleOnHitRogue(), BattlegroundBE::HandlePlayerUnderMap(), BattlegroundDS::HandlePlayerUnderMap(), BattlegroundNA::HandlePlayerUnderMap(), BattlegroundRL::HandlePlayerUnderMap(), BattlegroundRV::HandlePlayerUnderMap(), npc_pet_mage_mirror_image::InitializeAI(), boss_urom::boss_uromAI::JustDied(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::JustDied(), boss_noth::boss_nothAI::JustDied(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::JustReachedHome(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::MoveInLineOfSight(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MovementInform(), NearTeleportTo(), npc_akama_illidan::npc_akama_illidanAI::npc_akama_illidanAI(), npc_ball_of_flame::npc_ball_of_flameAI::npc_ball_of_flameAI(), npc_vh_sinclari::OnGossipSelect(), npc_cos_chromie_start::OnGossipSelect(), boss_gothik::boss_gothikAI::Reset(), Map::ScriptsProcess(), npc_midsummer_torch_target::SelectPosition(), npc_simon_bunny::npc_simon_bunnyAI::SetUpPreGame(), boss_urom::boss_uromAI::SpellHit(), boss_majordomo::boss_majordomoAI::SpellHit(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::SpellHitTarget(), npc_nerubian_burrower::npc_nerubian_burrowerAI::SpellHitTarget(), npc_pos_leader_second::npc_pos_leader_secondAI::SpellHitTarget(), boss_cyanigosa::boss_cyanigosaAI::SpellHitTarget(), BattlegroundRV::TeleportUnitToNewZ(), Vehicle::TeleportVehicle(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), boss_janalai::boss_janalaiAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), npc_coldflame::npc_coldflameAI::UpdateAI(), boss_magus_telestra::boss_magus_telestraAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_thorim_sif::boss_thorim_sifAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), npc_minigob_manabonk::npc_minigob_manabonkAI::UpdateAI(), boss_talon_king_ikiss::boss_talon_king_ikissAI::UpdateAI(), and boss_grandmaster_vorpil::boss_grandmaster_vorpilAI::UpdateAI().

◆ OutDebugInfo()

void Unit::OutDebugInfo ( ) const
20360{
20361 LOG_ERROR("entities.unit", "Unit::OutDebugInfo");
20362 LOG_INFO("entities.unit", "GUID {}, name {}", GetGUID().ToString(), GetName());
20363 LOG_INFO("entities.unit", "OwnerGUID {}, MinionGUID {}, CharmerGUID {}, CharmedGUID {}",
20365 LOG_INFO("entities.unit", "In world {}, unit type mask {}", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask);
20366 if (IsInWorld())
20367 LOG_INFO("entities.unit", "Mapid {}", GetMapId());
20368
20369 LOG_INFO("entities.unit", "Summon Slot: ");
20370 for (uint32 i = 0; i < MAX_SUMMON_SLOT; ++i)
20371 LOG_INFO("entities.unit", "{}, ", m_SummonSlot[i].ToString());
20372 LOG_INFO("server.loading", " ");
20373
20374 LOG_INFO("entities.unit", "Controlled List: ");
20375 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
20376 LOG_INFO("entities.unit", "{}, ", (*itr)->GetGUID().ToString());
20377 LOG_INFO("server.loading", " ");
20378
20379 LOG_INFO("entities.unit", "Aura List: ");
20380 for (AuraApplicationMap::const_iterator itr = m_appliedAuras.begin(); itr != m_appliedAuras.end(); ++itr)
20381 LOG_INFO("entities.unit", "{}, ", itr->first);
20382 LOG_INFO("server.loading", " ");
20383
20384 if (IsVehicle())
20385 {
20386 LOG_INFO("entities.unit", "Passenger List: ");
20387 for (SeatMap::iterator itr = GetVehicleKit()->Seats.begin(); itr != GetVehicleKit()->Seats.end(); ++itr)
20388 if (Unit* passenger = ObjectAccessor::GetUnit(*GetVehicleBase(), itr->second.Passenger.Guid))
20389 LOG_INFO("entities.unit", "{}, ", passenger->GetGUID().ToString());
20390 LOG_INFO("server.loading", " ");
20391 }
20392
20393 if (GetVehicle())
20394 LOG_INFO("entities.unit", "On vehicle {}.", GetVehicleBase()->GetEntry());
20395}
Seats
Definition: boss_flame_leviathan.cpp:159

References GetCharmerGUID(), GetCharmGUID(), Object::GetEntry(), Object::GetGUID(), WorldLocation::GetMapId(), GetMinionGUID(), WorldObject::GetName(), GetOwnerGUID(), ObjectAccessor::GetUnit(), GetVehicle(), GetVehicleBase(), GetVehicleKit(), Object::IsInWorld(), IsVehicle(), LOG_ERROR, LOG_INFO, m_appliedAuras, m_Controlled, m_SummonSlot, m_unitTypeMask, MAX_SUMMON_SLOT, and Position::ToString().

Referenced by SetMinion().

◆ PauseMovement()

void Unit::PauseMovement ( uint32  timer = 0,
uint8  slot = 0 
)
virtual
16818{
16819 if (slot >= MAX_MOTION_SLOT)
16820 return;
16821
16822 if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(slot))
16823 movementGenerator->Pause(timer);
16824
16825 StopMoving();
16826}
@ MAX_MOTION_SLOT
Definition: MotionMaster.h:64
void StopMoving()
Definition: Unit.cpp:16798
Definition: MovementGenerator.h:30

References GetMotionMaster(), MAX_MOTION_SLOT, and StopMoving().

Referenced by WorldSession::HandleBattlemasterHelloOpcode(), WorldSession::HandleGossipHelloOpcode(), WorldSession::HandleQuestgiverHelloOpcode(), and WorldSession::SendListInventory().

◆ PetSpellFail()

void Unit::PetSpellFail ( SpellInfo const *  spellInfo,
Unit target,
uint32  result 
)
20548{
20549 CharmInfo* charmInfo = GetCharmInfo();
20550 if (!charmInfo || GetTypeId() != TYPEID_UNIT)
20551 return;
20552
20554 {
20555 if ((result == SPELL_FAILED_LINE_OF_SIGHT || result == SPELL_FAILED_OUT_OF_RANGE) || !ToCreature()->HasReactState(REACT_PASSIVE))
20556 if (Unit* owner = GetOwner())
20557 {
20558 if (spellInfo->IsPositive() && IsFriendlyTo(target))
20559 {
20560 AttackStop();
20561 charmInfo->SetIsAtStay(false);
20562 charmInfo->SetIsCommandAttack(true);
20563 charmInfo->SetIsReturning(false);
20564 charmInfo->SetIsFollowing(false);
20565
20566 GetMotionMaster()->MoveFollow(target, PET_FOLLOW_DIST, rand_norm() * 2 * M_PI);
20567 }
20568 else if (owner->IsValidAttackTarget(target))
20569 {
20570 AttackStop();
20571 charmInfo->SetIsAtStay(false);
20572 charmInfo->SetIsCommandAttack(true);
20573 charmInfo->SetIsReturning(false);
20574 charmInfo->SetIsFollowing(false);
20575
20576 if (!ToCreature()->HasReactState(REACT_PASSIVE))
20577 ToCreature()->AI()->AttackStart(target);
20578 else
20579 GetMotionMaster()->MoveChase(target);
20580 }
20581 }
20582
20583 // can be extended in future
20584 if (result == SPELL_FAILED_LINE_OF_SIGHT || result == SPELL_FAILED_OUT_OF_RANGE)
20585 {
20586 charmInfo->SetForcedSpell(spellInfo->IsPositive() ? -int32(spellInfo->Id) : spellInfo->Id);
20587 charmInfo->SetForcedTargetGUID(target->GetGUID());
20588 }
20589 else
20590 {
20591 charmInfo->SetForcedSpell(0);
20593 }
20594 }
20595}
#define PET_FOLLOW_DIST
Definition: PetDefines.h:193
@ SPELL_FAILED_OUT_OF_RANGE
Definition: SharedDefines.h:1018
@ SPELL_FAILED_LINE_OF_SIGHT
Definition: SharedDefines.h:968
bool IsPathfindingEnabled(const Map *map)
Definition: DisableMgr.cpp:402
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:28
void SetIsAtStay(bool val)
Definition: Unit.cpp:20517
void SetIsFollowing(bool val)
Definition: Unit.cpp:20527
void SetIsReturning(bool val)
Definition: Unit.cpp:20537
void SetForcedSpell(uint32 id)
Definition: Unit.h:1144
void SetForcedTargetGUID(ObjectGuid guid=ObjectGuid::Empty)
Definition: Unit.h:1146
void SetIsCommandAttack(bool val)
Definition: Unit.cpp:20455
void MoveChase(Unit *target, std::optional< ChaseRange > dist={}, std::optional< ChaseAngle > angle={})
Definition: MotionMaster.cpp:299
void MoveFollow(Unit *target, float dist, float angle, MovementSlot slot=MOTION_SLOT_ACTIVE)
Definition: MotionMaster.cpp:367

References Creature::AI(), UnitAI::AttackStart(), AttackStop(), ObjectGuid::Empty, GetCharmInfo(), Object::GetGUID(), WorldObject::GetMap(), GetMotionMaster(), GetOwner(), Object::GetTypeId(), SpellInfo::Id, IsFriendlyTo(), DisableMgr::IsPathfindingEnabled(), SpellInfo::IsPositive(), MotionMaster::MoveChase(), MotionMaster::MoveFollow(), PET_FOLLOW_DIST, rand_norm(), REACT_PASSIVE, CharmInfo::SetForcedSpell(), CharmInfo::SetForcedTargetGUID(), CharmInfo::SetIsAtStay(), CharmInfo::SetIsCommandAttack(), CharmInfo::SetIsFollowing(), CharmInfo::SetIsReturning(), SPELL_FAILED_LINE_OF_SIGHT, SPELL_FAILED_OUT_OF_RANGE, Object::ToCreature(), and TYPEID_UNIT.

Referenced by WorldSession::HandlePetActionHelper(), and WorldSession::HandlePetCastSpellOpcode().

◆ ProcDamageAndSpell()

void Unit::ProcDamageAndSpell ( Unit actor,
Unit victim,
uint32  procAttacker,
uint32  procVictim,
uint32  procEx,
uint32  amount,
WeaponAttackType  attType = BASE_ATTACK,
SpellInfo const *  procSpellInfo = nullptr,
SpellInfo const *  procAura = nullptr,
int8  procAuraEffectIndex = -1,
Spell const *  procSpell = nullptr,
DamageInfo damageInfo = nullptr,
HealInfo healInfo = nullptr,
uint32  procPhase = 2 
)
static
6291{
6292 // Not much to do if no flags are set.
6293 if (procAttacker && actor)
6294 actor->ProcDamageAndSpellFor(false, victim, procAttacker, procExtra, attType, procSpellInfo, amount, procAura, procAuraEffectIndex, procSpell, damageInfo, healInfo, procPhase);
6295 // Now go on with a victim's events'n'auras
6296 // Not much to do if no flags are set or there is no victim
6297 if (victim && victim->IsAlive() && procVictim)
6298 victim->ProcDamageAndSpellFor(true, actor, procVictim, procExtra, attType, procSpellInfo, amount, procAura, procAuraEffectIndex, procSpell, damageInfo, healInfo, procPhase);
6299}

References IsAlive(), and ProcDamageAndSpellFor().

Referenced by Spell::_cast(), Spell::_handle_finish_phase(), AttackerStateUpdate(), Spell::DoAllEffectOnTarget(), ReflectEvent::Execute(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), and Kill().

◆ ProcDamageAndSpellFor()

void Unit::ProcDamageAndSpellFor ( bool  isVictim,
Unit target,
uint32  procFlag,
uint32  procExtra,
WeaponAttackType  attType,
SpellInfo const *  procSpellInfo,
uint32  damage,
SpellInfo const *  procAura = nullptr,
int8  procAuraEffectIndex = -1,
Spell const *  procSpell = nullptr,
DamageInfo damageInfo = nullptr,
HealInfo healInfo = nullptr,
uint32  procPhase = 2 
)
16203{
16204 // Player is loaded now - do not allow passive spell casts to proc
16205 if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetSession()->PlayerLoading())
16206 return;
16207 // For melee/ranged based attack need update skills and set some Aura states if victim present
16208 if (procFlag & MELEE_BASED_TRIGGER_MASK && target && procPhase == PROC_SPELL_PHASE_HIT)
16209 {
16210 // Xinef: Shaman in ghost wolf form cant proc anything melee based
16211 if (!isVictim && GetShapeshiftForm() == FORM_GHOSTWOLF)
16212 return;
16213
16214 // Update skills here for players
16215 // only when you are not fighting other players or their pets/totems (pvp)
16216 if (IsPlayer() && !target->IsCharmedOwnedByPlayerOrPlayer())
16217 {
16218 // On melee based hit/miss/resist/parry/dodge need to update skill (for victim and attacker)
16220 {
16221 ToPlayer()->UpdateCombatSkills(target, attType, isVictim, procSpell ? procSpell->m_weaponItem : nullptr);
16222 }
16223 // Update defence if player is victim and we block - TODO: confirm that blocked attacks only have a chance to increase defence skill
16224 else if (isVictim && procExtra & (PROC_EX_BLOCK))
16225 {
16226 ToPlayer()->UpdateCombatSkills(target, attType, true);
16227 }
16228 }
16229 // If exist crit/parry/dodge/block need update aura state (for victim and attacker)
16231 {
16232 // for victim
16233 if (isVictim)
16234 {
16235 // if victim and dodge attack
16236 if (procExtra & PROC_EX_DODGE)
16237 {
16238 // Update AURA_STATE on dodge
16239 if (getClass() != CLASS_ROGUE) // skip Rogue Riposte
16240 {
16243 }
16244 }
16245 // if victim and parry attack
16246 if (procExtra & PROC_EX_PARRY)
16247 {
16248 // For Hunters only Counterattack (skip Mongoose bite)
16249 if (getClass() == CLASS_HUNTER)
16250 {
16253 }
16254 else
16255 {
16258 }
16259 }
16260 // if and victim block attack
16261 if (procExtra & PROC_EX_BLOCK)
16262 {
16265 }
16266 }
16267 else // For attacker
16268 {
16269 // Overpower on victim dodge
16270 if (procExtra & PROC_EX_DODGE)
16271 {
16272 if (getClass() == CLASS_WARRIOR)
16273 {
16274 AddComboPoints(target, 1);
16276 }
16277 }
16278
16279 // Wolverine Bite
16280 if ((procExtra & PROC_HIT_CRITICAL) && IsHunterPet())
16281 {
16282 AddComboPoints(target, 1);
16284 }
16285 }
16286 }
16287 }
16288
16289 Unit* actor = isVictim ? target : this;
16290 Unit* actionTarget = !isVictim ? target : this;
16291
16292 ProcEventInfo eventInfo = ProcEventInfo(actor, actionTarget, target, procFlag, 0, procPhase, procExtra, procSpell, damageInfo, healInfo, procAura, procAuraEffectIndex);
16293
16294 ProcTriggeredList procTriggered;
16295 // Fill procTriggered list
16296 for (AuraApplicationMap::const_iterator itr = GetAppliedAuras().begin(); itr != GetAppliedAuras().end(); ++itr)
16297 {
16298 // Do not allow auras to proc from effect triggered by itself
16299 if (procAura && procAura->Id == itr->first)
16300 continue;
16301
16302 // Xinef: Generic Item Equipment cooldown, -1 is a special marker
16303 if (itr->second->GetBase()->GetCastItemGUID() && HasSpellItemCooldown(itr->first, uint32(-1)))
16304 continue;
16305
16306 ProcTriggeredData triggerData(itr->second->GetBase());
16307 // Defensive procs are active on absorbs (so absorption effects are not a hindrance)
16308 bool active = damage || (procExtra & PROC_EX_BLOCK && isVictim);
16309 if (isVictim)
16310 procExtra &= ~PROC_EX_INTERNAL_REQ_FAMILY;
16311
16312 SpellInfo const* spellProto = itr->second->GetBase()->GetSpellInfo();
16313
16314 // only auras that have trigger spell should proc from fully absorbed damage
16315 if (procExtra & PROC_EX_ABSORB && isVictim)
16316 if (damage || spellProto->Effects[EFFECT_0].TriggerSpell || spellProto->Effects[EFFECT_1].TriggerSpell || spellProto->Effects[EFFECT_2].TriggerSpell)
16317 active = true;
16318
16319 // xinef: fix spell procing from damaging / healing casts if spell has DoT / HoT effect only
16320 // only player spells are taken into account
16321 if (!active && !isVictim && !(procFlag & PROC_FLAG_DONE_PERIODIC) && procSpellInfo && procSpellInfo->SpellFamilyName && (procSpellInfo->HasAura(SPELL_AURA_PERIODIC_DAMAGE) || procSpellInfo->HasAura(SPELL_AURA_PERIODIC_HEAL)))
16322 active = true;
16323
16324 // AuraScript Hook
16325 if (!triggerData.aura->CallScriptCheckProcHandlers(itr->second, eventInfo))
16326 {
16327 continue;
16328 }
16329
16330 bool isTriggeredAtSpellProcEvent = IsTriggeredAtSpellProcEvent(target, triggerData.aura, attType, isVictim, active, triggerData.spellProcEvent, eventInfo);
16331
16332 // AuraScript Hook
16333 if (!triggerData.aura->CallScriptAfterCheckProcHandlers(itr->second, eventInfo, isTriggeredAtSpellProcEvent))
16334 {
16335 continue;
16336 }
16337
16338 // do checks using conditions table
16339 ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL_PROC, spellProto->Id);
16340 ConditionSourceInfo condInfo = ConditionSourceInfo(eventInfo.GetActor(), eventInfo.GetActionTarget());
16341 if (!sConditionMgr->IsObjectMeetToConditions(condInfo, conditions))
16342 {
16343 continue;
16344 }
16345
16346 // Triggered spells not triggering additional spells
16347 //bool triggered = !spellProto->HasAttribute(SPELL_ATTR3_CAN_PROC_FROM_PROCS) ?
16348 // (procExtra & PROC_EX_INTERNAL_TRIGGERED && !(procFlag & PROC_FLAG_DONE_TRAP_ACTIVATION)) : false;
16349
16350 bool hasTriggeredProc = false;
16351 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
16352 {
16353 if (itr->second->HasEffect(i))
16354 {
16355 AuraEffect* aurEff = itr->second->GetBase()->GetEffect(i);
16356
16357 // Skip this auras
16358 if (isNonTriggerAura[aurEff->GetAuraType()])
16359 continue;
16360
16361 // If not trigger by default and spellProcEvent == nullptr - skip
16362 if (!isTriggerAura[aurEff->GetAuraType()] && !triggerData.spellProcEvent)
16363 continue;
16364
16365 switch (aurEff->GetAuraType())
16366 {
16369 case SPELL_AURA_DUMMY:
16371 if (uint32 triggerSpellId = aurEff->GetSpellInfo()->Effects[i].TriggerSpell)
16372 {
16373 triggerData.triggerSpelId[i] = triggerSpellId;
16374 hasTriggeredProc = true;
16375 }
16376 break;
16377 default:
16378 break;
16379 }
16380
16381 // Some spells must always trigger
16382 //if (isAlwaysTriggeredAura[aurEff->GetAuraType()])
16383 triggerData.effMask |= 1 << i;
16384 }
16385 }
16386
16387 if (triggerData.effMask)
16388 {
16389 // If there is aura that triggers another proc aura, make sure that the triggered one is going to be proccessed on top of it
16390 if (hasTriggeredProc)
16391 {
16392 bool proccessed = false;
16393 for (uint8 i = 0; i < EFFECT_ALL; ++i)
16394 {
16395 if (uint32 triggeredSpellId = triggerData.triggerSpelId[i])
16396 {
16397 auto iter = std::find(procTriggered.begin(), procTriggered.end(), triggeredSpellId);
16398 if (iter != procTriggered.end())
16399 {
16400 std::advance(iter, 1);
16401 procTriggered.insert(iter, triggerData);
16402 proccessed = true;
16403 break;
16404 }
16405 }
16406 }
16407
16408 if (!proccessed)
16409 {
16410 procTriggered.push_front(triggerData);
16411 }
16412 }
16413 else
16414 {
16415 procTriggered.push_front(triggerData);
16416 }
16417 }
16418 }
16419
16420 // Nothing found
16421 if (procTriggered.empty())
16422 return;
16423
16424 // Note: must SetCantProc(false) before return
16426 SetCantProc(true);
16427
16428 // Handle effects proceed this time
16429 for (ProcTriggeredList::const_iterator i = procTriggered.begin(); i != procTriggered.end(); ++i)
16430 {
16431 // look for aura in auras list, it may be removed while proc event processing
16432 if (i->aura->IsRemoved())
16433 continue;
16434
16435 bool useCharges = i->aura->IsUsingCharges();
16436 // no more charges to use, prevent proc
16437 if (useCharges && !i->aura->GetCharges())
16438 continue;
16439
16440 bool takeCharges = false;
16441 SpellInfo const* spellInfo = i->aura->GetSpellInfo();
16442
16443 AuraApplication* aurApp = i->aura->GetApplicationOfTarget(GetGUID());
16444
16445 bool prepare = i->aura->CallScriptPrepareProcHandlers(aurApp, eventInfo);
16446
16447 // For players set spell cooldown if need
16448 uint32 cooldown = 0;
16449 if (prepare && i->spellProcEvent && i->spellProcEvent->cooldown)
16450 cooldown = i->spellProcEvent->cooldown;
16451
16452 // Xinef: set cooldown for actual proc
16453 eventInfo.SetProcCooldown(cooldown);
16454
16455 // Note: must SetCantProc(false) before return
16457 SetCantProc(true);
16458
16459 bool handled = i->aura->CallScriptProcHandlers(aurApp, eventInfo);
16460
16461 // "handled" is needed as long as proc can be handled in multiple places
16462 if (!handled && HandleAuraProc(target, damage, i->aura, procSpellInfo, procFlag, procExtra, cooldown, &handled))
16463 {
16464 uint32 Id = i->aura->GetId();
16465 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell {} (triggered with value by {} aura of spell {})", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), Id);
16466 takeCharges = true;
16467 }
16468
16469 if (!handled)
16470 for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
16471 {
16472 if (!(i->effMask & (1 << effIndex)))
16473 continue;
16474
16475 AuraEffect* triggeredByAura = i->aura->GetEffect(effIndex);
16476 ASSERT(triggeredByAura);
16477
16478 bool prevented = i->aura->CallScriptEffectProcHandlers(triggeredByAura, aurApp, eventInfo);
16479 if (prevented)
16480 {
16481 takeCharges = true;
16482 continue;
16483 }
16484
16485 switch (triggeredByAura->GetAuraType())
16486 {
16488 {
16489 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell {} (triggered by {} aura of spell {})", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId());
16490 // Don`t drop charge or add cooldown for not started trigger
16491 if (HandleProcTriggerSpell(target, damage, triggeredByAura, procSpellInfo, procFlag, procExtra, cooldown, procPhase, eventInfo))
16492 takeCharges = true;
16493 break;
16494 }
16496 {
16497 // target has to be valid
16498 if (!eventInfo.GetProcTarget())
16499 break;
16500
16501 triggeredByAura->HandleProcTriggerDamageAuraProc(aurApp, eventInfo); // this function is part of the new proc system
16502 takeCharges = true;
16503 break;
16504 }
16506 case SPELL_AURA_DUMMY:
16507 {
16508 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell id {} (triggered by {} dummy aura of spell {})", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId());
16509 if (HandleDummyAuraProc(target, damage, triggeredByAura, procSpellInfo, procFlag, procExtra, cooldown, procSpell))
16510 takeCharges = true;
16511 break;
16512 }
16517 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell id {} (triggered by {} aura of spell {})", spellInfo->Id, isVictim ? "a victim's" : "an attacker's", triggeredByAura->GetId());
16518 takeCharges = true;
16519 break;
16521 {
16522 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell id {} (triggered by {} aura of spell {})", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId());
16523 if (HandleOverrideClassScriptAuraProc(target, damage, triggeredByAura, procSpellInfo, cooldown))
16524 takeCharges = true;
16525 break;
16526 }
16528 {
16529 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting mending (triggered by {} dummy aura of spell {})",
16530 (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId());
16531 if (damage > 0)
16532 {
16534 takeCharges = true;
16535 }
16536 break;
16537 }
16539 {
16540 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting mending (triggered by {} dummy aura of spell {})",
16541 (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId());
16542 HandleAuraRaidProcFromCharge(triggeredByAura);
16543 takeCharges = true;
16544 break;
16545 }
16547 {
16548 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell {} (triggered with value by {} aura of spell {})", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId());
16549
16550 if (HandleProcTriggerSpell(target, damage, triggeredByAura, procSpellInfo, procFlag, procExtra, cooldown, procPhase, eventInfo))
16551 takeCharges = true;
16552 break;
16553 }
16555 // Skip melee hits or instant cast spells
16556 // xinef: check channeled spells which are affected by haste also
16557 if (procSpellInfo && (procSpellInfo->SpellFamilyName || GetTypeId() != TYPEID_PLAYER) &&
16558 (procSpellInfo->CalcCastTime() > 0 /*||
16559 (procSpell->IsChanneled() && procSpell->GetDuration() > 0 && (HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, procSpell) || procSpell->HasAttribute(SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC)))*/))
16560 takeCharges = true;
16561 break;
16563 // Skip Melee hits and spells ws wrong school
16564 if (procSpellInfo && (triggeredByAura->GetMiscValue() & procSpellInfo->SchoolMask)) // School check
16565 takeCharges = true;
16566 break;
16568 // Skip Melee hits and targets with magnet aura
16569 if (procSpellInfo && (triggeredByAura->GetBase()->GetUnitOwner()->ToUnit() == ToUnit())) // Magnet
16570 takeCharges = true;
16571 break;
16574 // Skip melee hits and spells ws wrong school or zero cost
16575 if (procSpellInfo &&
16576 (procSpellInfo->ManaCost != 0 || procSpellInfo->ManaCostPercentage != 0 || (procSpellInfo->SpellFamilyFlags[1] & 0x2)) && // Cost check, mutilate include
16577 (triggeredByAura->GetMiscValue() & procSpellInfo->SchoolMask)) // School check
16578 takeCharges = true;
16579 break;
16582 // Compare mechanic
16583 if (procSpellInfo && procSpellInfo->Mechanic == uint32(triggeredByAura->GetMiscValue()))
16584 takeCharges = true;
16585 break;
16587 // Compare casters
16588 if (target && triggeredByAura->GetCasterGUID() == target->GetGUID())
16589 takeCharges = true;
16590 break;
16591 // CC Auras which use their amount amount to drop
16592 // Are there any more auras which need this?
16598 {
16599 // Spell own direct damage at apply wont break the CC
16600 // Xinef: Or when the aura is at full duration (assume that such auras should be added at the end, skipping all damage procs etc.)
16601 if (procSpellInfo)
16602 if ((!i->aura->IsPermanent() && i->aura->GetDuration() == i->aura->GetMaxDuration()) || procSpellInfo->Id == triggeredByAura->GetId() ||
16603 procSpellInfo->HasAttribute(SPELL_ATTR4_REACTIVE_DAMAGE_PROC))
16604 break;
16605
16606 // chargeable mods are breaking on hit
16607 if (useCharges)
16608 takeCharges = true;
16609 else if (triggeredByAura->GetAmount()) // aura must have amount
16610 {
16611 int32 damageLeft = triggeredByAura->GetAmount();
16612 // No damage left
16613 if (damageLeft < int32(damage))
16614 i->aura->Remove();
16615 else
16616 triggeredByAura->SetAmount(damageLeft - damage);
16617 }
16618 break;
16619 }
16621 if (procSpellInfo && procSpellInfo->Id == 20647) // hack for warriors execute, both dummy and damage spell are affected by ignore aurastate aura
16622 break;
16623 takeCharges = true;
16624 break;
16627 {
16628 if (triggeredByAura->GetSpellModifier())
16629 {
16630 // Do proc if mod is consumed by spell
16631 if (!procSpell || procSpell->m_appliedMods.find(i->aura) != procSpell->m_appliedMods.end())
16632 {
16633 takeCharges = true;
16634 }
16635 }
16636 break;
16637 }
16638 default:
16639 takeCharges = true;
16640 break;
16641 }
16642 i->aura->CallScriptAfterEffectProcHandlers(triggeredByAura, aurApp, eventInfo);
16643 }
16644 // Remove charge (aura can be removed by triggers)
16645 // xinef: take into account attribute6 of proc spell
16646 if (prepare && useCharges && takeCharges)
16647 if (!procSpellInfo || isVictim || !procSpellInfo->HasAttribute(SPELL_ATTR6_DO_NOT_CONSUME_RESOURCES))
16648 i->aura->DropCharge();
16649
16650 i->aura->CallScriptAfterProcHandlers(aurApp, eventInfo);
16651
16653 SetCantProc(false);
16654 }
16655
16656 // Cleanup proc requirements
16658 SetCantProc(false);
16659}
@ CONDITION_SOURCE_TYPE_SPELL_PROC
Definition: ConditionMgr.h:146
static bool isNonTriggerAura[TOTAL_AURAS]
Definition: Unit.cpp:107
static bool isTriggerAura[TOTAL_AURAS]
Definition: Unit.cpp:105
std::list< ProcTriggeredData > ProcTriggeredList
Definition: Unit.cpp:16002
@ REACTIVE_OVERPOWER
Definition: Unit.h:1204
@ REACTIVE_DEFENSE
Definition: Unit.h:1202
@ REACTIVE_HUNTER_PARRY
Definition: Unit.h:1203
@ REACTIVE_WOLVERINE_BITE
Definition: Unit.h:1205
@ SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE
Definition: SpellAuraDefines.h:288
@ SPELL_AURA_ADD_PCT_MODIFIER
Definition: SpellAuraDefines.h:171
@ SPELL_AURA_OBS_MOD_POWER
Definition: SpellAuraDefines.h:84
@ SPELL_AURA_ADD_FLAT_MODIFIER
Definition: SpellAuraDefines.h:170
@ SPELL_AURA_MOD_SPELL_CRIT_CHANCE
Definition: SpellAuraDefines.h:120
@ SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
Definition: SpellAuraDefines.h:135
@ SPELL_AURA_MOD_POWER_COST_SCHOOL
Definition: SpellAuraDefines.h:136
@ SPELL_AURA_MECHANIC_IMMUNITY
Definition: SpellAuraDefines.h:140
@ SPELL_AURA_RAID_PROC_FROM_CHARGE
Definition: SpellAuraDefines.h:286
@ SPELL_AURA_PROC_TRIGGER_DAMAGE
Definition: SpellAuraDefines.h:106
@ SPELL_AURA_REFLECT_SPELLS_SCHOOL
Definition: SpellAuraDefines.h:137
@ SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK
Definition: SpellAuraDefines.h:128
@ PROC_HIT_CRITICAL
Definition: SpellMgr.h:253
#define MELEE_BASED_TRIGGER_MASK
Definition: SpellMgr.h:182
@ PROC_EX_INTERNAL_CANT_PROC
Definition: SpellMgr.h:218
@ PROC_EX_INTERNAL_TRIGGERED
Definition: SpellMgr.h:221
@ PROC_FLAG_DONE_PERIODIC
Definition: SpellMgr.h:134
@ EFFECT_2
Definition: SharedDefines.h:32
@ SPELL_ATTR3_INSTANT_TARGET_PROCS
Definition: SharedDefines.h:484
#define EFFECT_ALL
Definition: SharedDefines.h:37
@ SPELL_ATTR6_DO_NOT_CONSUME_RESOURCES
Definition: SharedDefines.h:581
void UpdateCombatSkills(Unit *victim, WeaponAttackType attType, bool defence, Item *item=nullptr)
Definition: PlayerUpdates.cpp:981
Definition: Unit.cpp:15983
Definition: Unit.h:839
void SetProcCooldown(uint32 cooldown)
Definition: Unit.h:873
Unit * GetActionTarget() const
Definition: Unit.h:859
Unit * GetProcTarget() const
Definition: Unit.h:860
bool HandleProcTriggerSpell(Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, uint32 procPhase, ProcEventInfo &eventInfo)
Definition: Unit.cpp:8885
bool HandleAuraRaidProcFromChargeWithValue(AuraEffect *triggeredByAura)
Definition: Unit.cpp:17696
bool IsHunterPet() const
Definition: Unit.h:1414
bool IsTriggeredAtSpellProcEvent(Unit *victim, Aura *aura, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *&spellProcEvent, ProcEventInfo const &eventInfo)
Definition: Unit.cpp:17557
bool HandleAuraProc(Unit *victim, uint32 damage, Aura *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, bool *handled)
Definition: Unit.cpp:8690
virtual bool HasSpellItemCooldown(uint32, uint32) const
Definition: Unit.h:2419
void StartReactiveTimer(ReactiveType reactive)
Definition: Unit.h:2313
bool HandleOverrideClassScriptAuraProc(Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 cooldown)
Definition: Unit.cpp:9834
bool HandleDummyAuraProc(Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, Spell const *spellProc=nullptr)
Definition: Unit.cpp:6501
bool HandleAuraRaidProcFromCharge(AuraEffect *triggeredByAura)
Definition: Unit.cpp:17785
bool IsCharmedOwnedByPlayerOrPlayer() const
Definition: Unit.h:1838
void HandleProcTriggerDamageAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:6900
SpellModifier * GetSpellModifier() const
Definition: SpellAuraEffects.h:52
Unit * GetUnitOwner() const
Definition: SpellAuras.h:108

References AddComboPoints(), ASSERT, ProcTriggeredData::aura, AURA_STATE_DEFENSE, AURA_STATE_HUNTER_PARRY, SpellInfo::CalcCastTime(), Aura::CallScriptAfterCheckProcHandlers(), Aura::CallScriptCheckProcHandlers(), CLASS_HUNTER, CLASS_ROGUE, CLASS_WARRIOR, CONDITION_SOURCE_TYPE_SPELL_PROC, EFFECT_0, EFFECT_1, EFFECT_2, EFFECT_ALL, SpellInfo::Effects, ProcTriggeredData::effMask, FORM_GHOSTWOLF, ProcEventInfo::GetActionTarget(), ProcEventInfo::GetActor(), AuraEffect::GetAmount(), GetAppliedAuras(), AuraEffect::GetAuraType(), AuraEffect::GetBase(), AuraEffect::GetCasterGUID(), getClass(), Aura::GetEffect(), Object::GetGUID(), AuraEffect::GetId(), AuraEffect::GetMiscValue(), ProcEventInfo::GetProcTarget(), GetShapeshiftForm(), AuraEffect::GetSpellInfo(), AuraEffect::GetSpellModifier(), Object::GetTypeId(), Aura::GetUnitOwner(), HandleAuraProc(), HandleAuraRaidProcFromCharge(), HandleAuraRaidProcFromChargeWithValue(), HandleDummyAuraProc(), HandleOverrideClassScriptAuraProc(), AuraEffect::HandleProcTriggerDamageAuraProc(), HandleProcTriggerSpell(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), HasSpellItemCooldown(), SpellInfo::Id, IsCharmedOwnedByPlayerOrPlayer(), IsHunterPet(), isNonTriggerAura, Object::IsPlayer(), isTriggerAura, IsTriggeredAtSpellProcEvent(), LOG_DEBUG, Spell::m_appliedMods, Spell::m_weaponItem, SpellInfo::ManaCost, SpellInfo::ManaCostPercentage, MAX_SPELL_EFFECTS, SpellInfo::Mechanic, MELEE_BASED_TRIGGER_MASK, ModifyAuraState(), PROC_EX_ABSORB, PROC_EX_BLOCK, PROC_EX_CRITICAL_HIT, PROC_EX_DODGE, PROC_EX_INTERNAL_CANT_PROC, PROC_EX_INTERNAL_TRIGGERED, PROC_EX_MISS, PROC_EX_NORMAL_HIT, PROC_EX_PARRY, PROC_EX_RESIST, PROC_FLAG_DONE_PERIODIC, PROC_HIT_CRITICAL, PROC_SPELL_PHASE_HIT, REACTIVE_DEFENSE, REACTIVE_HUNTER_PARRY, REACTIVE_OVERPOWER, REACTIVE_WOLVERINE_BITE, SpellInfo::SchoolMask, sConditionMgr, AuraEffect::SetAmount(), SetCantProc(), ProcEventInfo::SetProcCooldown(), SPELL_ATTR3_INSTANT_TARGET_PROCS, SPELL_ATTR4_REACTIVE_DAMAGE_PROC, SPELL_ATTR6_DO_NOT_CONSUME_RESOURCES, SPELL_AURA_ABILITY_IGNORE_AURASTATE, SPELL_AURA_ADD_FLAT_MODIFIER, SPELL_AURA_ADD_PCT_MODIFIER, SPELL_AURA_DUMMY, SPELL_AURA_MANA_SHIELD, SPELL_AURA_MECHANIC_IMMUNITY, SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK, SPELL_AURA_MOD_CONFUSE, SPELL_AURA_MOD_DAMAGE_FROM_CASTER, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_MECHANIC_RESISTANCE, SPELL_AURA_MOD_MELEE_HASTE, SPELL_AURA_MOD_POWER_COST_SCHOOL, SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_SPELL_CRIT_CHANCE, SPELL_AURA_MOD_STUN, SPELL_AURA_OBS_MOD_POWER, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PROC_TRIGGER_DAMAGE, SPELL_AURA_PROC_TRIGGER_SPELL, SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE, SPELL_AURA_RAID_PROC_FROM_CHARGE, SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE, SPELL_AURA_REFLECT_SPELLS_SCHOOL, SPELL_AURA_SPELL_MAGNET, SPELL_AURA_TRANSFORM, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, ProcTriggeredData::spellProcEvent, StartReactiveTimer(), Object::ToPlayer(), Object::ToUnit(), ProcTriggeredData::triggerSpelId, TYPEID_PLAYER, and Player::UpdateCombatSkills().

Referenced by CalcAbsorbResist(), and ProcDamageAndSpell().

◆ processDummyAuras()

float Unit::processDummyAuras ( float  TakenTotalMod) const
private
11826{
11827 // note: old code coming from TC, just extracted here to remove the code duplication + solve potential crash
11828 // see: https://github.com/TrinityCore/TrinityCore/commit/c85710e148d75450baedf6632b9ca6fd40b4148e
11829
11830 // .. taken pct: dummy auras
11831 auto const& mDummyAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY);
11832 for (auto i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i)
11833 {
11834 if (!(*i) || !(*i)->GetSpellInfo())
11835 {
11836 continue;
11837 }
11838
11839 if (auto spellIconId = (*i)->GetSpellInfo()->SpellIconID)
11840 {
11841 switch (spellIconId)
11842 {
11843 // Cheat Death
11844 case 2109:
11845 if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
11846 {
11847 // Patch 2.4.3: The resilience required to reach the 90% damage reduction cap
11848 // is 22.5% critical strike damage reduction, or 444 resilience.
11849 // To calculate for 90%, we multiply the 100% by 4 (22.5% * 4 = 90%)
11850 float mod = -1.0f * GetMeleeCritDamageReduction(400);
11851 AddPct(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
11852 }
11853 break;
11854 }
11855 }
11856 }
11857 return TakenTotalMod;
11858}

References AddPct(), GetAuraEffectsByType(), GetMeleeCritDamageReduction(), SPELL_AURA_DUMMY, and SPELL_SCHOOL_MASK_NORMAL.

Referenced by MeleeDamageBonusTaken(), and SpellDamageBonusTaken().

◆ ProcessPositionDataChanged()

void Unit::ProcessPositionDataChanged ( PositionFullTerrainStatus const &  data)
overridevirtual

Reimplemented from WorldObject.

4195{
4198}
virtual void ProcessPositionDataChanged(PositionFullTerrainStatus const &data)
Definition: Object.cpp:1163
virtual void ProcessTerrainStatusUpdate()
Definition: Unit.cpp:4200

References WorldObject::ProcessPositionDataChanged(), and ProcessTerrainStatusUpdate().

Referenced by Creature::Create().

◆ ProcessTerrainStatusUpdate()

void Unit::ProcessTerrainStatusUpdate ( )
virtual

Reimplemented in Player.

4201{
4202 if (GetTypeId() == TYPEID_UNIT)
4204
4205 if (IsFlying() || (!IsControlledByPlayer()))
4206 return;
4207
4208 LiquidData const& liquidData = GetLiquidData();
4209
4210 // remove appropriate auras if we are swimming/not swimming respectively
4211 if (liquidData.Status & MAP_LIQUID_STATUS_SWIMMING)
4213 else
4215
4216 // liquid aura handling
4217 LiquidTypeEntry const* curLiquid = nullptr;
4218 if ((liquidData.Status & MAP_LIQUID_STATUS_SWIMMING))
4219 curLiquid = sLiquidTypeStore.LookupEntry(liquidData.Entry);
4220
4221 if (curLiquid != _lastLiquid)
4222 {
4225
4226 // Set _lastLiquid before casting liquid spell to avoid infinite loops
4227 _lastLiquid = curLiquid;
4228
4230 if (curLiquid && curLiquid->SpellId && (!player || !player->IsGameMaster()))
4231 CastSpell(this, curLiquid->SpellId, true);
4232 }
4233}
DBCStorage< LiquidTypeEntry > sLiquidTypeStore(LiquidTypefmt)
@ AURA_INTERRUPT_FLAG_NOT_ABOVEWATER
Definition: SpellDefines.h:51
@ AURA_INTERRUPT_FLAG_NOT_UNDERWATER
Definition: SpellDefines.h:52
void UpdateMovementFlags()
Definition: Creature.cpp:3304
bool IsFlying() const
Definition: Unit.h:2385
Definition: Map.h:170
uint32 Entry
Definition: Map.h:173
Definition: DBCStructure.h:1266
uint32 SpellId
Definition: DBCStructure.h:1272

References _lastLiquid, AURA_INTERRUPT_FLAG_NOT_ABOVEWATER, AURA_INTERRUPT_FLAG_NOT_UNDERWATER, CastSpell(), LiquidData::Entry, GetCharmerOrOwnerPlayerOrPlayerItself(), WorldObject::GetLiquidData(), Object::GetTypeId(), IsControlledByPlayer(), IsFlying(), Player::IsGameMaster(), MAP_LIQUID_STATUS_SWIMMING, RemoveAurasDueToSpell(), RemoveAurasWithInterruptFlags(), sLiquidTypeStore, LiquidTypeEntry::SpellId, LiquidData::Status, Object::ToCreature(), TYPEID_UNIT, and Creature::UpdateMovementFlags().

Referenced by ProcessPositionDataChanged(), and Player::ProcessTerrainStatusUpdate().

◆ ProhibitSpellSchool()

virtual void Unit::ProhibitSpellSchool ( SpellSchoolMask  ,
uint32   
)
inlinevirtual

Reimplemented in Creature, and Player.

2048{ }

Referenced by Spell::EffectInterruptCast().

◆ propagateSpeedChange()

void Unit::propagateSpeedChange ( )
inline

-------—End of Pet responses methods-------—

void propagateSpeedChange()
Definition: MotionMaster.cpp:794

References GetMotionMaster(), and MotionMaster::propagateSpeedChange().

Referenced by SetSpeed(), and SetWalk().

◆ RecalculateObjectScale()

void Unit::RecalculateObjectScale ( )
virtual
16903{
16905 float scale = GetNativeObjectScale() + CalculatePct(1.0f, scaleAuras);
16906 float scaleMin = GetTypeId() == TYPEID_PLAYER ? 0.1f : 0.01f;
16907 SetObjectScale(std::max(scale, scaleMin));
16908}
@ SPELL_AURA_MOD_SCALE_2
Definition: SpellAuraDefines.h:302
@ SPELL_AURA_MOD_SCALE
Definition: SpellAuraDefines.h:124
virtual void SetObjectScale(float scale)
Definition: Object.h:113
virtual float GetNativeObjectScale() const
Definition: Unit.h:2166

References CalculatePct(), GetNativeObjectScale(), GetTotalAuraModifier(), Object::GetTypeId(), Object::SetObjectScale(), SPELL_AURA_MOD_SCALE, SPELL_AURA_MOD_SCALE_2, and TYPEID_PLAYER.

Referenced by AuraEffect::HandleAuraModScale().

◆ RemoveAllAttackers()

void Unit::RemoveAllAttackers ( )
10445{
10446 while (!m_attackers.empty())
10447 {
10448 AttackerSet::iterator iter = m_attackers.begin();
10449 if (!(*iter)->AttackStop())
10450 {
10451 LOG_ERROR("entities.unit", "WORLD: Unit has an attacker that isn't attacking it!");
10452 m_attackers.erase(iter);
10453 }
10454 }
10455}

References LOG_ERROR, and m_attackers.

Referenced by CombatStop(), Spell::EffectSanctuary(), boss_kelthuzad::boss_kelthuzadAI::EnterCombat(), AuraEffect::HandleFeignDeath(), spell_halion_twilight_phasing::spell_halion_twilight_phasing_AuraScript::OnApply(), spell_halion_twilight_phasing::spell_halion_twilight_phasing_AuraScript::OnRemove(), and npc_qiraj_war_spawn::npc_qiraj_war_spawnAI::UpdateAI().

◆ RemoveAllAuras()

void Unit::RemoveAllAuras ( )
5240{
5241 // this may be a dead loop if some events on aura remove will continiously apply aura on remove
5242 // we want to have all auras removed, so use your brain when linking events
5243 while (!m_appliedAuras.empty() || !m_ownedAuras.empty())
5244 {
5245 AuraApplicationMap::iterator aurAppIter;
5246 for (aurAppIter = m_appliedAuras.begin(); aurAppIter != m_appliedAuras.end();)
5248
5249 AuraMap::iterator aurIter;
5250 for (aurIter = m_ownedAuras.begin(); aurIter != m_ownedAuras.end();)
5251 RemoveOwnedAura(aurIter);
5252 }
5253}

References _UnapplyAura(), AURA_REMOVE_BY_DEFAULT, m_appliedAuras, m_ownedAuras, and RemoveOwnedAura().

Referenced by CleanupBeforeRemoveFromMap(), npc_mograine::npc_mograineAI::DamageTaken(), boss_kiljaeden::boss_kiljaedenAI::DamageTaken(), boss_muru::boss_muruAI::DamageTaken(), boss_headless_horseman_head::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_crystalline_frayer::npc_crystalline_frayerAI::DamageTaken(), boss_freya::boss_freyaAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::DamageTaken(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::DamageTaken(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::DamageTaken(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), spell_rotface_unstable_ooze_explosion_suicide::spell_rotface_unstable_ooze_explosion_suicide_AuraScript::DespawnSelf(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), boss_taldaram::DoAction(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), npc_anubarak_spike::npc_anubarak_spikeAI::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DoAction(), boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::DoAction(), npc_taretha::npc_tarethaAI::DoAction(), boss_razorgore::boss_razorgoreAI::DoChangePhase(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), boss_taldaram::EnterCombat(), boss_mimiron::boss_mimironAI::EnterCombat(), boss_novos::boss_novosAI::EnterCombat(), boss_professor_putricide::boss_professor_putricideAI::EnterCombat(), boss_commander_stoutbeard::boss_commander_stoutbeardAI::EnterCombat(), boss_mimiron::boss_mimironAI::EnterEvadeMode(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::EnterEvadeMode(), npc_ulduar_vx001::npc_ulduar_vx001AI::EnterEvadeMode(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::EnterEvadeMode(), GuardAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_escortAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), hyjalAI::EnterEvadeMode(), LichKingDeathEvent::Execute(), npc_rocket_propelled_warhead::npc_rocket_propelled_warheadAI::FinishQuest(), spell_herald_volzaj_insanity::HandleDummyEffect(), misc_commandscript::HandleUnAuraCommand(), boss_venoxis::boss_venoxisAI::JustDied(), boss_ick::boss_ickAI::JustDied(), boss_steelbreaker::boss_steelbreakerAI::JustReachedHome(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::JustReachedHome(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::JustReachedHome(), boss_urom::boss_uromAI::LeaveCombat(), boss_taldaram::MovementInform(), npc_hallows_end_soh::MovementInform(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::MovementInform(), spell_kaelthas_flame_strike::spell_kaelthas_flame_strike_AuraScript::OnRemove(), PretendToDie(), Creature::RemoveCorpse(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::Reset(), boss_venoxis::boss_venoxisAI::Reset(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::Reset(), boss_thaddius::boss_thaddiusAI::Reset(), boss_bjarngrim::boss_bjarngrimAI::Reset(), boss_loken::boss_lokenAI::Reset(), boss_hodir::boss_hodirAI::Reset(), boss_xt002::boss_xt002AI::Reset(), boss_skadi::boss_skadiAI::Reset(), boss_skadi_grauf::boss_skadi_graufAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), Pet::SavePetToDB(), npc_anubarak_spike::npc_anubarak_spikeAI::SelectNewTarget(), npc_harrison_jones::npc_harrison_jonesAI::SpellHit(), npc_frost_sphere::npc_frost_sphereAI::SpellHit(), npc_tirion_fordring_tft::npc_tirion_fordringAI::SpellHit(), npc_ulduar_flames_spread::npc_ulduar_flames_spreadAI::SpellHit(), npc_soh_fire_trigger::SpellHit(), npc_hallows_end_train_fire::SpellHit(), boss_headless_horseman_head::SpellHit(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::SummonedCreatureDies(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::UpdateAI(), npc_icc_putricades_trap::npc_icc_putricades_trapAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_magus_telestra::boss_magus_telestraAI::UpdateAI(), npc_hol_monument::npc_hol_monumentAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), boss_high_botanist_freywinn::boss_high_botanist_freywinnAI::UpdateAI(), and npc_aeranas::npc_aeranasAI::UpdateAI().

◆ RemoveAllAurasExceptType()

void Unit::RemoveAllAurasExceptType ( AuraType  type)
5314{
5315 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5316 {
5317 Aura const* aura = iter->second->GetBase();
5318 if (aura->GetSpellInfo()->HasAura(type))
5319 ++iter;
5320 else
5322 }
5323
5324 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5325 {
5326 Aura* aura = iter->second;
5327 if (aura->GetSpellInfo()->HasAura(type))
5328 ++iter;
5329 else
5331 }
5332}

References _UnapplyAura(), AURA_REMOVE_BY_DEFAULT, Aura::GetSpellInfo(), SpellInfo::HasAura(), m_appliedAuras, m_ownedAuras, and RemoveOwnedAura().

Referenced by npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), spell_q11919_q11940_drake_hunt::spell_q11919_q11940_drake_hunt_AuraScript::HandleEffectRemove(), and npc_iron_watcher::npc_iron_watcherAI::SpellHit().

◆ RemoveAllAurasOnDeath()

void Unit::RemoveAllAurasOnDeath ( )
5270{
5271 // used just after dieing to remove all visible auras
5272 // and disable the mods for the passive ones
5273 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5274 {
5275 Aura const* aura = iter->second->GetBase();
5278 else
5279 ++iter;
5280 }
5281
5282 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5283 {
5284 Aura* aura = iter->second;
5287 else
5288 ++iter;
5289 }
5290}
@ AURA_REMOVE_BY_DEATH
Definition: SpellAuraDefines.h:396
@ SPELL_ATTR7_DISABLE_AURA_WHILE_DEAD
Definition: SharedDefines.h:615
bool IsDeathPersistent() const
Definition: SpellAuras.cpp:1101

References _UnapplyAura(), AURA_REMOVE_BY_DEATH, Aura::GetSpellInfo(), SpellInfo::HasAttribute(), Aura::IsDeathPersistent(), Aura::IsPassive(), m_appliedAuras, m_ownedAuras, RemoveOwnedAura(), and SPELL_ATTR7_DISABLE_AURA_WHILE_DEAD.

Referenced by spell_dk_death_pact::FilterTargets(), Kill(), Player::LoadFromDB(), and setDeathState().

◆ RemoveAllAurasRequiringDeadTarget()

void Unit::RemoveAllAurasRequiringDeadTarget ( )
5293{
5294 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5295 {
5296 Aura const* aura = iter->second->GetBase();
5297 if (!aura->IsPassive() && aura->GetSpellInfo()->IsRequiringDeadTarget())
5299 else
5300 ++iter;
5301 }
5302
5303 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5304 {
5305 Aura* aura = iter->second;
5306 if (!aura->IsPassive() && aura->GetSpellInfo()->IsRequiringDeadTarget())
5308 else
5309 ++iter;
5310 }
5311}
bool IsRequiringDeadTarget() const
Definition: SpellInfo.cpp:1206

References _UnapplyAura(), AURA_REMOVE_BY_DEFAULT, Aura::GetSpellInfo(), Aura::IsPassive(), SpellInfo::IsRequiringDeadTarget(), m_appliedAuras, m_ownedAuras, and RemoveOwnedAura().

Referenced by Player::LoadFromDB().

◆ RemoveAllControlled()

void Unit::RemoveAllControlled ( bool  onDeath = false)
11047{
11048 // possessed pet and vehicle
11049 if (GetTypeId() == TYPEID_PLAYER)
11051
11052 while (!m_Controlled.empty())
11053 {
11054 Unit* target = *m_Controlled.begin();
11055 m_Controlled.erase(m_Controlled.begin());
11056 if (target->GetCharmerGUID() == GetGUID())
11057 {
11058 target->RemoveCharmAuras();
11059 }
11060 else if (target->GetOwnerGUID() == GetGUID() && target->IsSummon())
11061 {
11062 if (!(onDeath && !IsPlayer() && target->IsGuardian()))
11063 {
11064 target->ToTempSummon()->UnSummon();
11065 }
11066 }
11067 else
11068 {
11069 LOG_ERROR("entities.unit", "Unit {} is trying to release unit {} which is neither charmed nor owned by it", GetEntry(), target->GetEntry());
11070 }
11071 }
11072}
void StopCastingCharm()
Definition: Player.cpp:9182
bool IsGuardian() const
Definition: Unit.h:1411
void RemoveCharmAuras()
Definition: Unit.cpp:11157

References GetCharmerGUID(), Object::GetEntry(), Object::GetGUID(), GetOwnerGUID(), Object::GetTypeId(), IsGuardian(), Object::IsPlayer(), IsSummon(), LOG_ERROR, m_Controlled, RemoveCharmAuras(), Player::StopCastingCharm(), Object::ToPlayer(), ToTempSummon(), TYPEID_PLAYER, and TempSummon::UnSummon().

Referenced by Player::ActivateSpec(), RemoveFromWorld(), and setDeathState().

◆ RemoveAllDynObjects()

void Unit::RemoveAllDynObjects ( )
6076{
6077 while (!m_dynObj.empty())
6078 m_dynObj.front()->Remove();
6079}

References m_dynObj.

Referenced by RemoveFromWorld(), Player::TeleportTo(), and npc_icc_putricades_trap::npc_icc_putricades_trapAI::UpdateAI().

◆ RemoveAllGameObjects()

void Unit::RemoveAllGameObjects ( )
6176{
6177 while(!m_gameObj.empty())
6178 {
6179 GameObject* go = ObjectAccessor::GetGameObject(*this, *m_gameObj.begin());
6180 if(go)
6181 {
6183 go->SetRespawnTime(0);
6184 go->Delete();
6185 }
6186 m_gameObj.erase(m_gameObj.begin());
6187 }
6188}
void Delete()
Definition: GameObject.cpp:976
void SetRespawnTime(int32 respawn)
Definition: GameObject.cpp:1301

References GameObject::Delete(), ObjectGuid::Empty, ObjectAccessor::GetGameObject(), m_gameObj, GameObject::SetOwnerGUID(), and GameObject::SetRespawnTime().

Referenced by CleanupBeforeRemoveFromMap(), npc_ice_tomb::npc_ice_tombAI::JustDied(), RemoveFromWorld(), npc_brewfest_super_brew_trigger::UpdateAI(), and boss_sapphiron::boss_sapphironAI::UpdateAI().

◆ RemoveAllMinionsByEntry()

void Unit::RemoveAllMinionsByEntry ( uint32  entry)
10824{
10825 for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();)
10826 {
10827 Unit* unit = *itr;
10828 ++itr;
10829 if (unit->GetEntry() == entry && unit->GetTypeId() == TYPEID_UNIT
10830 && unit->ToCreature()->IsSummon()) // minion, actually
10831 unit->ToTempSummon()->UnSummon();
10832 // i think this is safe because i have never heard that a despawned minion will trigger a same minion
10833 }
10834}

References Object::GetEntry(), Object::GetTypeId(), IsSummon(), m_Controlled, Object::ToCreature(), ToTempSummon(), TYPEID_UNIT, and TempSummon::UnSummon().

Referenced by Player::ApplyEquipSpell(), Spell::EffectSummonType(), npc_nelson::npc_nelsonAI::Reset(), SetMinion(), and npc_nelson::npc_nelsonAI::UpdateAI().

◆ RemoveAppliedAuras() [1/2]

void Unit::RemoveAppliedAuras ( std::function< bool(AuraApplication const *)> const &  check)
4797{
4798 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
4799 {
4800 if (check(iter->second))
4801 {
4802 RemoveAura(iter);
4803 continue;
4804 }
4805 ++iter;
4806 }
4807}

References m_appliedAuras, and RemoveAura().

Referenced by RemoveArenaAuras().

◆ RemoveAppliedAuras() [2/2]

void Unit::RemoveAppliedAuras ( uint32  spellId,
std::function< bool(AuraApplication const *)> const &  check 
)
4823{
4824 for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
4825 {
4826 if (check(iter->second))
4827 {
4828 RemoveAura(iter);
4829 continue;
4830 }
4831 ++iter;
4832 }
4833}

References m_appliedAuras, and RemoveAura().

◆ RemoveAreaAurasDueToLeaveWorld()

void Unit::RemoveAreaAurasDueToLeaveWorld ( )
5207{
5208 // make sure that all area auras not applied on self are removed - prevent access to deleted pointer later
5209 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5210 {
5211 Aura* aura = iter->second;
5212 ++iter;
5213 Aura::ApplicationMap const& appMap = aura->GetApplicationMap();
5214 for (Aura::ApplicationMap::const_iterator itr = appMap.begin(); itr != appMap.end();)
5215 {
5216 AuraApplication* aurApp = itr->second;
5217 ++itr;
5218 Unit* target = aurApp->GetTarget();
5219 if (target == this)
5220 continue;
5221 target->RemoveAura(aurApp);
5222 // things linked on aura remove may apply new area aura - so start from the beginning
5223 iter = m_ownedAuras.begin();
5224 }
5225 }
5226
5227 // remove area auras owned by others
5228 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5229 {
5230 if (iter->second->GetBase()->GetOwner() != this)
5231 {
5232 RemoveAura(iter);
5233 }
5234 else
5235 ++iter;
5236 }
5237}
ApplicationMap const & GetApplicationMap()
Definition: SpellAuras.h:181
std::map< ObjectGuid, AuraApplication * > ApplicationMap
Definition: SpellAuras.h:90

References Aura::GetApplicationMap(), AuraApplication::GetTarget(), m_appliedAuras, m_ownedAuras, and RemoveAura().

Referenced by RemoveFromWorld().

◆ RemoveArenaAuras()

void Unit::RemoveArenaAuras ( )
5256{
5257 // in join, remove positive buffs, on end, remove negative
5258 // used to remove positive visible auras in arenas
5259 RemoveAppliedAuras([](AuraApplication const* aurApp)
5260 {
5261 Aura const* aura = aurApp->GetBase();
5262 return (!aura->GetSpellInfo()->HasAttribute(SPELL_ATTR4_ALLOW_ENETRING_ARENA) // don't remove stances, shadowform, pally/hunter auras
5263 && !aura->IsPassive() // don't remove passive auras
5264 && (aurApp->IsPositive() || !aura->GetSpellInfo()->HasAttribute(SPELL_ATTR3_ALLOW_AURA_WHILE_DEAD))) || // not negative death persistent auras
5265 aura->GetSpellInfo()->HasAttribute(SPELL_ATTR5_REMOVE_ENTERING_ARENA); // special marker, always remove
5266 });
5267}
@ SPELL_ATTR5_REMOVE_ENTERING_ARENA
Definition: SharedDefines.h:541
@ SPELL_ATTR3_ALLOW_AURA_WHILE_DEAD
Definition: SharedDefines.h:485
@ SPELL_ATTR4_ALLOW_ENETRING_ARENA
Definition: SharedDefines.h:523
void RemoveAppliedAuras(std::function< bool(AuraApplication const *)> const &check)
Definition: Unit.cpp:4796
bool IsPositive() const
Definition: SpellAuras.h:68

References AuraApplication::GetBase(), Aura::GetSpellInfo(), SpellInfo::HasAttribute(), Aura::IsPassive(), AuraApplication::IsPositive(), RemoveAppliedAuras(), SPELL_ATTR3_ALLOW_AURA_WHILE_DEAD, SPELL_ATTR4_ALLOW_ENETRING_ARENA, and SPELL_ATTR5_REMOVE_ENTERING_ARENA.

Referenced by Player::TeleportTo().

◆ RemoveAura() [1/4]

void Unit::RemoveAura ( Aura aur,
AuraRemoveMode  mode = AURA_REMOVE_BY_DEFAULT 
)
4776{
4777 if (aura->IsRemoved())
4778 return;
4779 if (AuraApplication* aurApp = aura->GetApplicationOfTarget(GetGUID()))
4780 RemoveAura(aurApp, mode);
4781}

References Aura::GetApplicationOfTarget(), Object::GetGUID(), Aura::IsRemoved(), and RemoveAura().

◆ RemoveAura() [2/4]

void Unit::RemoveAura ( AuraApplication aurApp,
AuraRemoveMode  mode = AURA_REMOVE_BY_DEFAULT 
)
4741{
4742 // we've special situation here, RemoveAura called while during aura removal
4743 // this kind of call is needed only when aura effect removal handler
4744 // or event triggered by it expects to remove
4745 // not yet removed effects of an aura
4746 if (aurApp->GetRemoveMode())
4747 {
4748 // remove remaining effects of an aura
4749 for (uint8 itr = 0; itr < MAX_SPELL_EFFECTS; ++itr)
4750 {
4751 if (aurApp->HasEffect(itr))
4752 aurApp->_HandleEffect(itr, false);
4753 }
4754 return;
4755 }
4756 // no need to remove
4757 if (aurApp->GetBase()->GetApplicationOfTarget(GetGUID()) != aurApp || aurApp->GetBase()->IsRemoved())
4758 return;
4759
4760 uint32 spellId = aurApp->GetBase()->GetId();
4761 AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
4762
4763 for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
4764 {
4765 if (aurApp == iter->second)
4766 {
4767 RemoveAura(iter, mode);
4768 return;
4769 }
4770 else
4771 ++iter;
4772 }
4773}

References AuraApplication::_HandleEffect(), Aura::GetApplicationOfTarget(), AuraApplication::GetBase(), Object::GetGUID(), Aura::GetId(), AuraApplication::GetRemoveMode(), AuraApplication::HasEffect(), Aura::IsRemoved(), m_appliedAuras, MAX_SPELL_EFFECTS, and RemoveAura().

◆ RemoveAura() [3/4]

void Unit::RemoveAura ( AuraApplicationMap::iterator &  i,
AuraRemoveMode  mode = AURA_REMOVE_BY_DEFAULT 
)
4709{
4710 AuraApplication* aurApp = i->second;
4711 // Do not remove aura which is already being removed
4712 if (aurApp->GetRemoveMode())
4713 return;
4714 Aura* aura = aurApp->GetBase();
4715 _UnapplyAura(i, mode);
4716 // Remove aura - for Area and Target auras
4717 if (aura->GetOwner() == this)
4718 aura->Remove(mode);
4719
4720 sScriptMgr->OnAuraRemove(this, aurApp, mode);
4721}

References _UnapplyAura(), AuraApplication::GetBase(), Aura::GetOwner(), AuraApplication::GetRemoveMode(), Aura::Remove(), and sScriptMgr.

Referenced by _RemoveNoStackAurasDueToAura(), ApplySpellDispelImmunity(), Player::CheckAreaExploreAndOutdoor(), boss_gyth::boss_gythAI::DamageTaken(), boss_headless_horseman::DamageTaken(), npc_power_spark::npc_power_sparkAI::DamageTaken(), boss_viscidus::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), npc_hor_lich_king::npc_hor_lich_kingAI::DoAction(), boss_victor_nefarius::boss_victor_nefariusAI::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), npc_pilgrims_bounty_chair::DoAction(), boss_paletress::boss_paletressAI::DoAction(), boss_vezax::boss_vezaxAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::DoAction(), boss_yoggsaron_corruptor_tentacle::boss_yoggsaron_corruptor_tentacleAI::DoAction(), boss_yoggsaron_constrictor_tentacle::boss_yoggsaron_constrictor_tentacleAI::DoAction(), boss_ichoron::boss_ichoronAI::DoExplodeCompleted(), Player::DuelComplete(), Spell::EffectDispelMechanic(), Spell::EffectForceCast(), Spell::EffectHeal(), Spell::EffectSummonPet(), Spell::EffectTriggerSpell(), npc_zulian_prowler::npc_zulian_prowlerAI::EnterCombat(), boss_jaraxxus::boss_jaraxxusAI::EnterCombat(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::EnterCombat(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), GetDiseasesByCaster(), AuraEffect::HandleAuraLinked(), AuraEffect::HandleAuraModSchoolImmunity(), Aura::HandleAuraSpecificMods(), deserter_commandscript::HandleDeserterRemove(), deserter_commandscript::HandleDeserterRemoveAll(), spell_q12096_q12092_bark::spell_q12096_q12092_bark_SpellScript::HandleDummy(), HandleDummyAuraProc(), spell_valanar_kinetic_bomb::spell_valanar_kinetic_bomb_AuraScript::HandleDummyTick(), spell_warl_demonic_circle_summon::HandleDummyTick(), spell_dk_improved_blood_presence::HandleEffectRemove(), spell_dk_improved_frost_presence::HandleEffectRemove(), spell_dk_improved_unholy_presence::HandleEffectRemove(), spell_dk_presence::HandleEffectRemove(), spell_pal_blessing_of_sanctuary::HandleEffectRemove(), spell_sha_chain_heal::HandleHeal(), spell_sindragosa_frost_breath::spell_sindragosa_frost_breath_SpellScript::HandleInfusion(), spell_warl_demonic_circle_summon::HandleRemove(), spell_putricide_eat_ooze::spell_putricide_eat_ooze_SpellScript::HandleScript(), AuraEffect::HandleShapeshiftBoosts(), npc_ulduar_snow_mound::npc_ulduar_snow_moundAI::MoveInLineOfSight(), spell_blood_queen_vampiric_bite::spell_blood_queen_vampiric_bite_SpellScript::OnCast(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), npc_essence_of_twin::OnGossipHello(), spell_love_is_in_the_air_romantic_picnic::OnPeriodic(), spell_yogg_saron_empowered::spell_yogg_saron_empowered_AuraScript::OnPeriodic(), npc_thrall_bfu::OnQuestReward(), npc_vortex_ride::npc_vortex_rideAI::PassengerBoarded(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::PassengerBoarded(), npc_eastvale_peasent::PathEndReached(), spell_midsummer_ribbon_pole::PrepareAuraScript(), BattlefieldWG::PromotePlayer(), RemoveAppliedAuras(), RemoveAreaAurasDueToLeaveWorld(), RemoveAura(), RemoveAurasByShapeShift(), RemoveAurasByType(), RemoveAurasDueToItemSpell(), RemoveAurasDueToSpell(), RemoveAurasWithAttribute(), RemoveAurasWithFamily(), RemoveAurasWithInterruptFlags(), RemoveAurasWithMechanic(), RemoveMovementImpairingAuras(), BattlegroundIC::RemovePlayer(), BattlegroundMap::RemovePlayerFromMap(), boss_bjarngrim::boss_bjarngrimAI::RemoveStanceAura(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::Reset(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_garfrost::boss_garfrostAI::Reset(), boss_varos::boss_varosAI::Reset(), NPCStaveQuestAI::ResetState(), boss_anomalus::boss_anomalusAI::SetData(), boss_hodir::boss_hodirAI::SmallIcicles(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::SpellHit(), boss_malygos::boss_malygosAI::SpellHit(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::SpellHit(), npc_nelson::npc_nelsonAI::SpellHit(), boss_headless_horseman::SpellHit(), boss_viscidus::SpellHit(), spell_pal_hand_of_sacrifice_aura::Split(), boss_sartharion_shadron::boss_sartharion_shadronAI::SummonedCreatureDies(), boss_terestian_illhoof::boss_terestianAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_harrison_jones::npc_harrison_jonesAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_marli::UpdateAI(), boss_headless_horseman::UpdateAI(), npc_onyxian_lair_guard::UpdateAI(), boss_viscidus::UpdateAI(), boss_taldaram::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_loken::boss_lokenAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_freya::boss_freyaAI::UpdateAI(), boss_freya_elder_brightleaf::boss_freya_elder_brightleafAI::UpdateAI(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::UpdateAI(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), npc_akama_shade::npc_akamaAI::UpdateAI(), boss_ahune::boss_ahuneAI::UpdateAI(), Spell::UpdateChanneledTargetList(), and boss_bjarngrim::boss_bjarngrimAI::WaypointReached().

◆ RemoveAura() [4/4]

void Unit::RemoveAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4724{
4725 AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
4726 for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
4727 {
4728 Aura const* aura = iter->second->GetBase();
4729 if (((aura->GetEffectMask() & reqEffMask) == reqEffMask)
4730 && (!caster || aura->GetCasterGUID() == caster))
4731 {
4732 RemoveAura(iter, removeMode);
4733 return;
4734 }
4735 else
4736 ++iter;
4737 }
4738}

References Aura::GetCasterGUID(), Aura::GetEffectMask(), m_appliedAuras, and RemoveAura().

◆ RemoveAuraFromStack()

void Unit::RemoveAuraFromStack ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4852{
4853 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
4854 for (AuraMap::iterator iter = range.first; iter != range.second;)
4855 {
4856 Aura* aura = iter->second;
4857 if ((aura->GetType() == UNIT_AURA_TYPE)
4858 && (!casterGUID || aura->GetCasterGUID() == casterGUID))
4859 {
4860 aura->ModStackAmount(-1, removeMode);
4861 return;
4862 }
4863 else
4864 ++iter;
4865 }
4866}
@ UNIT_AURA_TYPE
Definition: SpellAuraDefines.h:385
bool ModStackAmount(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT, bool periodicReset=false)
Definition: SpellAuras.cpp:1035
AuraObjectType GetType() const
Definition: SpellAuras.cpp:481

References Aura::GetCasterGUID(), Aura::GetType(), m_ownedAuras, Aura::ModStackAmount(), and UNIT_AURA_TYPE.

Referenced by Spell::EffectSchoolDMG(), HandleAuraProc(), HandleDummyAuraProc(), spell_putricide_gaseous_bloat::spell_putricide_gaseous_bloat_AuraScript::HandleExtraEffect(), spell_oculus_evasive_maneuvers::spell_oculus_evasive_maneuvers_AuraScript::HandleProc(), spell_dk_scent_of_blood::HandleProc(), spell_item_brittle_armor::HandleScript(), spell_item_mercurial_shield::HandleScript(), boss_viscidus::SpellHit(), boss_archimonde::boss_archimondeAI::UnleashSoulCharge(), and boss_selin_fireheart::boss_selin_fireheartAI::UpdateAI().

◆ RemoveAurasByShapeShift()

void Unit::RemoveAurasByShapeShift ( )
5191{
5192 uint32 mechanic_mask = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT);
5193 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5194 {
5195 Aura const* aura = iter->second->GetBase();
5196 if ((aura->GetSpellInfo()->GetAllEffectsMechanicMask() & mechanic_mask) &&
5198 {
5199 RemoveAura(iter);
5200 continue;
5201 }
5202 ++iter;
5203 }
5204}
@ SPELL_ATTR0_CU_AURA_CC
Definition: SpellInfo.h:181
uint32 GetAllEffectsMechanicMask() const
Definition: SpellInfo.cpp:1977

References SpellInfo::GetAllEffectsMechanicMask(), Aura::GetSpellInfo(), SpellInfo::HasAttribute(), m_appliedAuras, MECHANIC_ROOT, MECHANIC_SNARE, RemoveAura(), SPELL_ATTR0_CU_AURA_CC, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

Referenced by AuraEffect::HandleAuraModShapeshift().

◆ RemoveAurasByType()

void Unit::RemoveAurasByType ( AuraType  auraType,
ObjectGuid  casterGUID = ObjectGuid::Empty,
Aura except = nullptr,
bool  negative = true,
bool  positive = true 
)
5026{
5027 // simple check if list is empty
5028 if (m_modAuras[auraType].empty())
5029 return;
5030
5031 for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();)
5032 {
5033 Aura* aura = (*iter)->GetBase();
5035
5036 ++iter;
5037 if (aura != except && (!casterGUID || aura->GetCasterGUID() == casterGUID)
5038 && ((negative && !aurApp->IsPositive()) || (positive && aurApp->IsPositive())))
5039 {
5040 uint32 removedAuras = m_removedAurasCount;
5041 RemoveAura(aurApp);
5042 if (m_removedAurasCount > removedAuras + 1)
5043 iter = m_modAuras[auraType].begin();
5044 }
5045 }
5046}

References Aura::GetApplicationOfTarget(), Aura::GetCasterGUID(), Object::GetGUID(), AuraApplication::IsPositive(), m_modAuras, m_removedAurasCount, and RemoveAura().

Referenced by _ApplyAura(), _EnterVehicle(), Spell::_handle_finish_phase(), Player::ActivateTaxiPathTo(), Battleground::AddPlayer(), Attack(), spell_gen_summon_tournament_mount::CheckIfLanceEquiped(), ClearComboPoints(), Player::ContinueTaxiFlight(), boss_kologarn_arms::boss_kologarn_armsAI::DamageTaken(), Spell::DoSpellHitOnUnit(), Spell::EffectPowerBurn(), Spell::EffectSanctuary(), Spell::EffectTriggerSpell(), BattlegroundWS::EventPlayerClickedOnFlag(), ExitVehicle(), WorldSession::HandleAuctionHelloOpcode(), WorldSession::HandleAuctionListBidderItems(), WorldSession::HandleAuctionListItems(), WorldSession::HandleAuctionListOwnerItemsEvent(), WorldSession::HandleAuctionPlaceBid(), WorldSession::HandleAuctionRemoveItem(), WorldSession::HandleAuctionSellItem(), spell_warl_seduction::HandleAuraApply(), AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraModStateImmunity(), AuraEffect::HandleAuraMounted(), AuraEffect::HandleAuraTransform(), WorldSession::HandleBankerActivateOpcode(), WorldSession::HandleBinderActivateOpcode(), WorldSession::HandleBuybackItem(), WorldSession::HandleBuyStableSlot(), WorldSession::HandleCancelMountAuraOpcode(), misc_commandscript::HandleDismountCommand(), spell_item_reindeer_transformation::HandleDummy(), spell_item_brewfest_mount_transformation::HandleDummy(), HandleDummyAuraProc(), WorldSession::HandleGossipSelectOptionOpcode(), spell_finger_of_death::spell_finger_of_death_SpellScript::HandleHit(), spell_hand_of_death::spell_hand_of_death_SpellScript::HandleHit(), WorldSession::HandleListStabledPetsOpcode(), AuraEffect::HandleModMechanicImmunity(), AuraEffect::HandleModStateImmunityMask(), WorldSession::HandleMoveWorldportAck(), spell_oculus_rider_aura::spell_oculus_rider_auraAuraScript::HandleOnEffectApply(), spell_algalon_remove_phase::spell_algalon_remove_phase_AuraScript::HandlePeriodic(), WorldSession::HandlePetitionBuyOpcode(), WorldSession::HandleQuestgiverHelloOpcode(), WorldSession::HandleRepairItemOpcode(), WorldSession::HandleSaveGuildEmblemOpcode(), spell_gen_mine_sweeper::HandleSchoolDMG(), WorldSession::HandleSellItemOpcode(), WorldSession::HandleSpiritHealerActivateOpcode(), WorldSession::HandleStablePet(), WorldSession::HandleStableSwapPet(), WorldSession::HandleTabardVendorActivateOpcode(), WorldSession::HandleTalentWipeConfirmOpcode(), WorldSession::HandleTaxiQueryAvailableNodes(), WorldSession::HandleTrainerBuySpellOpcode(), WorldSession::HandleUnstablePet(), Player::LeaveBattleground(), Player::LoadFromDB(), WorldSession::LogoutPlayer(), spell_gen_aura_service_uniform::OnApply(), Player::ProcessDelayedOperations(), npc_dancing_flames::npc_dancing_flamesAI::ReceiveEmote(), Vehicle::RemoveAllPassengers(), RemoveBindSightAuras(), RemoveCharmAuras(), Battleground::RemovePlayerAtLeave(), WorldSession::SendDoFlight(), WorldSession::SendListInventory(), Player::SendLoot(), WorldSession::SendTrainerList(), SetCharmedBy(), Player::TeleportTo(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_gurtogg_bloodboil::boss_gurtogg_bloodboilAI::UpdateAI(), GameObject::Use(), and npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::WaypointReached().

◆ RemoveAurasDueToItemSpell()

void Unit::RemoveAurasDueToItemSpell ( uint32  spellId,
ObjectGuid  castItemGuid 
)
5012{
5013 for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
5014 {
5015 if (iter->second->GetBase()->GetCastItemGUID() == castItemGuid)
5016 {
5017 RemoveAura(iter);
5018 iter = m_appliedAuras.lower_bound(spellId);
5019 }
5020 else
5021 ++iter;
5022 }
5023}

References m_appliedAuras, and RemoveAura().

Referenced by Player::ApplyEnchantment(), and Player::ApplyEquipSpell().

◆ RemoveAurasDueToSpell()

void Unit::RemoveAurasDueToSpell ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4836{
4837 for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
4838 {
4839 Aura const* aura = iter->second->GetBase();
4840 if (((aura->GetEffectMask() & reqEffMask) == reqEffMask)
4841 && (!casterGUID || aura->GetCasterGUID() == casterGUID))
4842 {
4843 RemoveAura(iter, removeMode);
4844 iter = m_appliedAuras.lower_bound(spellId);
4845 }
4846 else
4847 ++iter;
4848 }
4849}

References Aura::GetCasterGUID(), Aura::GetEffectMask(), m_appliedAuras, and RemoveAura().

Referenced by Spell::_cast(), Player::_removeTalentAurasAndSpells(), Player::ActivateSpec(), Vehicle::AddPassenger(), spell_dru_feral_swiftness::AfterRemove(), spell_dru_barkskin::AfterRemove(), spell_dru_savage_roar_aura::AfterRemove(), spell_dru_survival_instincts_aura::AfterRemove(), Player::ApplyEquipSpell(), boss_hakkar::boss_hakkarAI::ApplyHakkarPowerStacks(), boss_buru::ChaseNewVictim(), spell_eredar_twins_handle_touch::spell_eredar_twins_handle_touch_SpellScript::CheckCast(), boss_volazj::CheckPhaseMinions(), spell_botanica_shift_form::spell_botanica_shift_form_AuraScript::CheckProc(), spell_mage_burning_determination::CheckProc(), boss_isle_of_conquest::boss_isle_of_conquestAI::CheckRageBuff(), Player::CleanupAfterTaxiFlight(), AuraEffect::CleanupTriggeredSpells(), npc_kerlonian::npc_kerlonianAI::ClearSleeping(), spell_ruby_sanctum_rallying_shout::spell_ruby_sanctum_rallying_shout_SpellScript::CountAllies(), boss_jeklik::DamageTaken(), boss_baron_geddon::boss_baron_geddonAI::DamageTaken(), boss_apothecary_hummel::boss_apothecary_hummelAI::DamageTaken(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_buru::DamageTaken(), Player::DestroyItem(), npc_drakonid_spawner::DoAction(), npc_twilight_volunteer::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), npc_massive_jormungar::npc_massive_jormungarAI::DoAction(), npc_ferocious_rhino::npc_ferocious_rhinoAI::DoAction(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::DoAction(), npc_frenzied_worgen::npc_frenzied_worgenAI::DoAction(), boss_ambassador_hellmaw::boss_ambassador_hellmawAI::DoAction(), boss_illidan_stormrage::boss_illidan_stormrageAI::DoAction(), npc_pet_gen_argent_pony_bridle::DoAction(), boss_laj::boss_lajAI::DoTransform(), Spell::DoTriggersOnSpellHit(), Spell::EffectApplyGlyph(), Spell::EffectHeal(), Spell::EffectRemoveAura(), Spell::EffectSchoolDMG(), boss_jeklik::EnterCombat(), boss_bronjahm::boss_bronjahmAI::EnterCombat(), npc_pet_shaman_fire_elemental::EnterCombat(), boss_the_lich_king::boss_the_lich_kingAI::EnterCombat(), boss_buru::EnterCombat(), boss_gal_darah::boss_gal_darahAI::EnterCombat(), boss_prince_keleseth_icc::boss_prince_kelesethAI::EnterCombat(), boss_prince_taldaram_icc::boss_prince_taldaramAI::EnterCombat(), boss_prince_valanar_icc::boss_prince_valanarAI::EnterCombat(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::EnterCombat(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::EnterCombat(), boss_zuljin::boss_zuljinAI::EnterPhase(), BattlegroundWS::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerDroppedFlag(), BattlegroundWS::EventPlayerDroppedFlag(), npc_unworthy_initiate::npc_unworthy_initiateAI::EventStart(), BattleExperienceEvent::Execute(), SendEncounterUnit::Execute(), FrostBombExplosion::Execute(), AuraRemoveEvent::Execute(), spell_sindragosa_ice_tomb::spell_sindragosa_ice_tomb_AuraScript::ExtraRemoveEffect(), spell_warr_improved_spell_reflection_trigger::FilterTargets(), lfg::LFGMgr::FinishDungeon(), spell_dru_berserk::HandleAfterCast(), BattlegroundDS::HandleAreaTrigger(), OutdoorPvPSI::HandleAreaTrigger(), AuraEffect::HandleAuraControlVehicle(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModShapeshift(), Aura::HandleAuraSpecificMods(), boss_janalai::boss_janalaiAI::HandleBombSequence(), spell_moroes_vanish::spell_moroes_vanish_SpellScript::HandleDummy(), spell_q13007_iron_colossus::spell_q13007_iron_colossus_SpellScript::HandleDummy(), spell_ahn_kahet_swarmer_aura::HandleDummy(), spell_halion_twilight_division::spell_halion_twilight_division_SpellScript::HandleDummy(), spell_putricide_ooze_eruption_searcher::spell_putricide_ooze_eruption_searcher_SpellScript::HandleDummy(), spell_warhead_detonate::spell_warhead_detonate_SpellScript::HandleDummy(), spell_dru_starfall_dummy::HandleDummy(), HandleDummyAuraProc(), spell_shadowfang_keep_forsaken_skills::spell_shadowfang_keep_forsaken_skills_AuraScript::HandleDummyTick(), spell_oculus_soar::spell_oculus_soarAuraScript::HandleEffectPeriodic(), spell_q12730_quenching_mist::HandleEffectPeriodic(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), spell_mc_play_dead::spell_mc_play_dead_AuraScript::HandleEffectRemove(), spell_reliquary_of_souls_aura_of_suffering::spell_reliquary_of_souls_aura_of_suffering_AuraScript::HandleEffectRemove(), spell_serpentshrine_cavern_coilfang_water::spell_serpentshrine_cavern_coilfang_water_AuraScript::HandleEffectRemove(), spell_q10769_dissension_amongst_the_ranks_aura::HandleEffectRemove(), boss_ragnaros::boss_ragnarosAI::HandleEmerge(), spell_midsummer_fling_torch::HandleFinish(), gm_commandscript::HandleGMVisibleCommand(), spell_oculus_drake_flag::spell_oculus_drake_flagAuraScript::HandleOnEffectApply(), spell_oculus_rider_aura::spell_oculus_rider_auraAuraScript::HandleOnEffectRemove(), spell_transitus_shield_beam::spell_transitus_shield_beam_AuraScript::HandleOnEffectRemove(), OPvPCapturePointZM_GraveYard::HandleOpenGo(), spell_hadronox_summon_periodic::spell_hadronox_summon_periodic_AuraScript::HandlePeriodic(), spell_algalon_phase_punch::spell_algalon_phase_punch_AuraScript::HandlePeriodic(), spell_algalon_remove_phase::spell_algalon_remove_phase_AuraScript::HandlePeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), OutdoorPvPEP::HandlePlayerLeaveZone(), OutdoorPvPHP::HandlePlayerLeaveZone(), OutdoorPvPNA::HandlePlayerLeaveZone(), OutdoorPvPSI::HandlePlayerLeaveZone(), OutdoorPvPTF::HandlePlayerLeaveZone(), OutdoorPvPZM::HandlePlayerLeaveZone(), spell_gen_consume::HandleProc(), spell_item_blood_draining_enchant::HandleProc(), HandleProcTriggerSpell(), spell_icc_harvest_blight_specimen::spell_icc_harvest_blight_specimen_SpellScript::HandleQuestComplete(), spell_felmyst_fog_of_corruption_charm::spell_felmyst_fog_of_corruption_charm_AuraScript::HandleRemove(), spell_kiljaeden_vengeance_of_the_blue_flight::spell_kiljaeden_vengeance_of_the_blue_flight_AuraScript::HandleRemove(), spell_dru_enrage::HandleRemove(), spell_pal_divine_intervention::HandleRemove(), spell_pal_avenging_wrath::HandleRemove(), spell_rog_killing_spree::spell_rog_killing_spree_AuraScript::HandleRemove(), spell_warr_vigilance::HandleRemove(), WorldSession::HandleRemoveGlyph(), spell_najentus_hurl_spine::spell_najentus_hurl_spine_SpellScript::HandleSchoolDamage(), spell_putricide_clear_aura_effect_value::spell_putricide_clear_aura_effect_value_SpellScript::HandleScript(), spell_the_lich_king_jump::spell_the_lich_king_jump_SpellScript::HandleScript(), spell_the_lich_king_jump_remove_aura::spell_the_lich_king_jump_SpellScript::HandleScript(), spell_icc_harvest_blight_specimen::spell_icc_harvest_blight_specimen_SpellScript::HandleScript(), spell_festergut_pungent_blight::spell_festergut_pungent_blight_SpellScript::HandleScript(), spell_festergut_gastric_bloat::spell_festergut_gastric_bloat_SpellScript::HandleScript(), spell_putricide_unbound_plague::spell_putricide_unbound_plague_SpellScript::HandleScript(), spell_putricide_eat_ooze::spell_putricide_eat_ooze_SpellScript::HandleScript(), spell_rotface_little_ooze_combine::spell_rotface_little_ooze_combine_SpellScript::HandleScript(), spell_rotface_large_ooze_combine::spell_rotface_large_ooze_combine_SpellScript::HandleScript(), spell_rotface_large_ooze_buff_combine::spell_rotface_large_ooze_buff_combine_SpellScript::HandleScript(), spell_black_template_free_friend::spell_black_template_free_friend_SpellScript::HandleScriptEffect(), spell_halion_clear_debuffs::spell_halion_clear_debuffs_SpellScript::HandleScriptEffect(), spell_q12823_remove_collapsing_cave_aura::HandleScriptEffect(), AuraEffect::HandleShapeshiftBoosts(), ArenaSpectator::HandleSpectatorWatchCommand(), AuraEffect::HandleSpiritOfRedemption(), misc_commandscript::HandleUnAuraCommand(), misc_commandscript::HandleUnFreezeCommand(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::HealReceived(), npc_underbog_mushroom::InitializeAI(), npc_demon_chain::npc_demon_chainAI::JustDied(), boss_azuregos::boss_azuregosAI::JustDied(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::JustDied(), boss_hydross_the_unstable::boss_hydross_the_unstableAI::JustReachedHome(), boss_garfrost::boss_garfrostAI::MovementInform(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::MovementInform(), boss_felmyst::boss_felmystAI::MovementInform(), boss_kaelthas::boss_kaelthasAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), boss_skadi_grauf::boss_skadi_graufAI::MovementInform(), npc_image_of_medivh::npc_image_of_medivhAI::NextStep(), spell_halion_twilight_realm::spell_halion_twilight_realm_AuraScript::OnApply(), spell_halion_leave_twilight_realm::spell_halion_leave_twilight_realm_AuraScript::OnApply(), spell_systems_shutdown::spell_systems_shutdown_AuraScript::OnApply(), npc_eye_of_acherus::OnCharmed(), npc_aged_dying_ancient_kodo::OnGossipHello(), lfg::LFGPlayerScript::OnMapChanged(), spell_yogg_saron_empowered::spell_yogg_saron_empowered_AuraScript::OnPeriodic(), spell_illidan_demon_transform2::spell_illidan_demon_transform2_AuraScript::OnPeriodic(), BattlefieldWG::OnPlayerLeaveZone(), spell_halion_combustion_consumption::spell_halion_combustion_consumption_AuraScript::OnRemove(), spell_halion_leave_twilight_realm::spell_halion_leave_twilight_realm_AuraScript::OnRemove(), spell_algalon_phase_punch::spell_algalon_phase_punch_AuraScript::OnRemove(), spell_load_into_catapult::spell_load_into_catapult_AuraScript::OnRemove(), spell_gen_damage_reduction_aura::OnRemove(), spell_hun_ascpect_of_the_viper::OnRemove(), spell_hun_viper_attack_speed::OnRemove(), spell_item_with_mount_speed::OnRemove(), spell_item_shadowmourne::OnRemove(), spell_item_shadowmourne_soul_fragment::OnRemove(), spell_mage_combustion_proc::OnRemove(), spell_item_shadowmourne_soul_fragment::OnStackChange(), npc_wild_wyrm::npc_wild_wyrmAI::PassengerBoarded(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::PassengerBoarded(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::PassengerBoarded(), boss_malchezaar::boss_malchezaarAI::Phase3(), spell_fight_fire_bomber::spell_fight_fire_bomber_SpellScript::PrepareSpellScript(), ProcessTerrainStatusUpdate(), spell_gen_defend::RefreshVisualShields(), RemoveAurasDueToSpellByDispel(), BattlefieldWG::RemoveAurasFromPlayer(), boss_festergut::boss_festergutAI::RemoveBlight(), spell_warl_health_funnel::RemoveEffect(), RemoveGameObject(), BattlegroundAV::RemovePlayer(), Battleground::RemovePlayerFromResurrectQueue(), boss_keristrasza::boss_keristraszaAI::RemovePrison(), Pet::removeSpell(), Player::removeSpell(), spell_gen_eject_all_passengers::RemoveVehicleAuras(), spell_gen_defend::RemoveVisualShields(), boss_terestian_illhoof::boss_terestianAI::Reset(), npc_mograine::npc_mograineAI::Reset(), boss_baroness_anastari::boss_baroness_anastariAI::Reset(), boss_twilight_corrupter::Reset(), boss_mandokir::boss_mandokirAI::Reset(), boss_cthun::Reset(), boss_viscidus::Reset(), boss_halion::boss_halionAI::Reset(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::Reset(), boss_lethon::boss_lethonAI::Reset(), boss_taerar::boss_taerarAI::Reset(), kaylaan_the_lost::kaylaan_the_lostAI::ResetDeathblowEvent(), Player::ResurrectPlayer(), npc_finklestein::npc_finklesteinAI::RightClickCauldron(), boss_supremus::boss_supremusAI::SchedulePhase(), Player::SendQuestUpdate(), npc_corrupted_totem::SetAura(), OPvPCapturePointZM_GraveYard::SetBeaconState(), boss_hydross_the_unstable::boss_hydross_the_unstableAI::SetForm(), Player::SetGMVisible(), boss_mandokir::boss_mandokirAI::SetGUID(), Player::SetIsSpectator(), SetModelVisible(), boss_viscidus::SoftReset(), boss_ossirian::SpellHit(), npc_omen::npc_omenAI::SpellHit(), npc_captured_rageclaw::npc_captured_rageclawAI::SpellHit(), npc_troll_volunteer::npc_troll_volunteerAI::SpellHit(), boss_sister_svalna::boss_sister_svalnaAI::SpellHit(), boss_faerlina::boss_faerlinaAI::SpellHit(), boss_moorabi::boss_moorabiAI::SpellHitTarget(), boss_festergut::boss_festergutAI::SpellHitTarget(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SummonedCreatureDespawn(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), boss_cthun::SummonedCreatureDies(), npc_kiljaeden_controller::npc_kiljaeden_controllerAI::SummonedCreatureDies(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonedCreatureDies(), boss_anzu::boss_anzuAI::SummonedCreatureDies(), boss_viscidus::SummonedCreatureDies(), Player::SummonPet(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), boss_netherspite::boss_netherspiteAI::SwitchToBanishPhase(), boss_netherspite::boss_netherspiteAI::SwitchToPortalPhase(), Totem::UnSummon(), spell_black_temple_spell_absorption::spell_black_temple_spell_absorption_AuraScript::Update(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_shade_of_aran::boss_aranAI::UpdateAI(), npc_eye_of_acherus::UpdateAI(), npc_mograine::npc_mograineAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), npc_singularity::npc_singularityAI::UpdateAI(), boss_nalorakk::boss_nalorakkAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), boss_moam::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), npc_draenei_survivor::npc_draenei_survivorAI::UpdateAI(), boss_volazj::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), npc_frost_sphere::npc_frost_sphereAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_freya_lifebinder::boss_freya_lifebinderAI::UpdateAI(), boss_freya_healthy_spore::boss_freya_healthy_sporeAI::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), boss_anzu::boss_anzuAI::UpdateAI(), boss_doomwalker::boss_doomwalkerAI::UpdateAI(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::UpdateAI(), boss_magtheridon::boss_magtheridonAI::UpdateAI(), boss_alar::boss_alarAI::UpdateAI(), boss_kaelthas::boss_kaelthasAI::UpdateAI(), boss_pathaleon_the_calculator::boss_pathaleon_the_calculatorAI::UpdateAI(), socrethar::socretharAI::UpdateAI(), npc_pet_gen_soul_trader_beacon::UpdateAI(), npc_pet_gen_argent_pony_bridle::UpdateAI(), boss_taerar::boss_taerarAI::UpdateAI(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::UpdateAI(), and Player::UpdateTitansGrip().

◆ RemoveAurasDueToSpellByDispel()

void Unit::RemoveAurasDueToSpellByDispel ( uint32  spellId,
uint32  dispellerSpellId,
ObjectGuid  casterGUID,
Unit dispeller,
uint8  chargesRemoved = 1 
)
4869{
4870 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
4871 for (AuraMap::iterator iter = range.first; iter != range.second;)
4872 {
4873 Aura* aura = iter->second;
4874 if (aura->GetCasterGUID() == casterGUID)
4875 {
4876 DispelInfo dispelInfo(dispeller, dispellerSpellId, chargesRemoved);
4877
4878 // Call OnDispel hook on AuraScript
4879 aura->CallScriptDispel(&dispelInfo);
4880
4882 aura->ModCharges(-dispelInfo.GetRemovedCharges(), AURA_REMOVE_BY_ENEMY_SPELL);
4883 else
4884 aura->ModStackAmount(-dispelInfo.GetRemovedCharges(), AURA_REMOVE_BY_ENEMY_SPELL);
4885
4886 // Call AfterDispel hook on AuraScript
4887 aura->CallScriptAfterDispel(&dispelInfo);
4888
4889 switch (aura->GetSpellInfo()->SpellFamilyName)
4890 {
4891 case SPELLFAMILY_HUNTER:
4892 {
4893 // Noxious Stings
4894 if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x1000)
4895 {
4896 if (Unit* caster = aura->GetCaster())
4897 {
4898 if (AuraEffect* aureff = caster->GetAuraEffect(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELLFAMILY_HUNTER, 3521, 1))
4899 {
4900 if (Aura* noxious = Aura::TryCreate(aura->GetSpellInfo(), aura->GetEffectMask(), dispeller, caster))
4901 {
4902 noxious->SetDuration(aura->GetDuration() * aureff->GetAmount() / 100);
4903 if (aura->GetUnitOwner() )
4904 if (const std::vector<int32>* spell_triggered = sSpellMgr->GetSpellLinked(-int32(aura->GetId())))
4905 for (std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
4906 aura->GetUnitOwner()->RemoveAurasDueToSpell(*itr);
4907 }
4908 }
4909 }
4910 }
4911 break;
4912 }
4914 {
4915 // Icy Clutch, remove with Frost Fever
4916 if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x4000000)
4917 {
4918 if (AuraEffect* aureff = GetAuraEffect(SPELL_AURA_MOD_DECREASE_SPEED, SPELLFAMILY_DEATHKNIGHT, 0, 0x40000, 0, casterGUID))
4919 RemoveAurasDueToSpell(aureff->GetId());
4920 }
4921 }
4922 default:
4923 break;
4924 }
4925 return;
4926 }
4927 else
4928 ++iter;
4929 }
4930}
Definition: Unit.h:727
void CallScriptDispel(DispelInfo *dispelInfo)
Definition: SpellAuras.cpp:2394
static Aura * TryCreate(SpellInfo const *spellproto, uint8 effMask, WorldObject *owner, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemGUID=ObjectGuid::Empty)
Definition: SpellAuras.cpp:352
bool ModCharges(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: SpellAuras.cpp:987
void CallScriptAfterDispel(DispelInfo *dispelInfo)
Definition: SpellAuras.cpp:2407

References AURA_REMOVE_BY_ENEMY_SPELL, Aura::CallScriptAfterDispel(), Aura::CallScriptDispel(), GetAuraEffect(), Aura::GetCaster(), Aura::GetCasterGUID(), Aura::GetDuration(), Aura::GetEffectMask(), Aura::GetId(), DispelInfo::GetRemovedCharges(), Aura::GetSpellInfo(), Aura::GetUnitOwner(), SpellInfo::HasAttribute(), m_ownedAuras, Aura::ModCharges(), Aura::ModStackAmount(), RemoveAurasDueToSpell(), SPELL_ATTR7_DISPEL_REMOVES_CHARGES, SPELL_AURA_MOD_DECREASE_SPEED, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_HUNTER, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, sSpellMgr, and Aura::TryCreate().

Referenced by Spell::EffectDispel().

◆ RemoveAurasDueToSpellBySteal()

void Unit::RemoveAurasDueToSpellBySteal ( uint32  spellId,
ObjectGuid  casterGUID,
Unit stealer 
)
4933{
4934 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
4935 for (AuraMap::iterator iter = range.first; iter != range.second;)
4936 {
4937 Aura* aura = iter->second;
4938 if (aura->GetCasterGUID() == casterGUID)
4939 {
4940 int32 damage[MAX_SPELL_EFFECTS];
4941 int32 baseDamage[MAX_SPELL_EFFECTS];
4942 uint8 effMask = 0;
4943 uint8 recalculateMask = 0;
4944 Unit* caster = aura->GetCaster();
4945 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
4946 {
4947 if (aura->GetEffect(i))
4948 {
4949 baseDamage[i] = aura->GetEffect(i)->GetBaseAmount();
4950 damage[i] = aura->GetEffect(i)->GetAmount();
4951 effMask |= (1 << i);
4952 if (aura->GetEffect(i)->CanBeRecalculated())
4953 recalculateMask |= (1 << i);
4954 }
4955 else
4956 {
4957 baseDamage[i] = 0;
4958 damage[i] = 0;
4959 }
4960 }
4961
4963 // Cast duration to unsigned to prevent permanent aura's such as Righteous Fury being permanently added to caster
4964 uint32 dur = std::min(2u * MINUTE * IN_MILLISECONDS, uint32(aura->GetDuration()));
4965
4966 if (Aura* oldAura = stealer->GetAura(aura->GetId(), aura->GetCasterGUID()))
4967 {
4968 if (stealCharge)
4969 oldAura->ModCharges(1);
4970 else
4971 oldAura->ModStackAmount(1);
4972 oldAura->SetDuration(int32(dur));
4973 }
4974 else
4975 {
4976 // single target state must be removed before aura creation to preserve existing single target aura
4977 if (aura->IsSingleTarget())
4978 aura->UnregisterSingleTarget();
4979
4980 // Xinef: if stealer has same aura
4981 Aura* curAura = stealer->GetAura(aura->GetId());
4982 if (!curAura || (!curAura->IsPermanent() && curAura->GetDuration() < (int32)dur))
4983 if (Aura* newAura = Aura::TryRefreshStackOrCreate(aura->GetSpellInfo(), effMask, stealer, nullptr, &baseDamage[0], nullptr, aura->GetCasterGUID()))
4984 {
4985 // created aura must not be single target aura,, so stealer won't loose it on recast
4986 if (newAura->IsSingleTarget())
4987 {
4988 newAura->UnregisterSingleTarget();
4989 // bring back single target aura status to the old aura
4990 aura->SetIsSingleTarget(true);
4991 caster->GetSingleCastAuras().push_back(aura);
4992 }
4993 // FIXME: using aura->GetMaxDuration() maybe not blizzlike but it fixes stealing of spells like Innervate
4994 newAura->SetLoadedState(aura->GetMaxDuration(), int32(dur), stealCharge ? 1 : aura->GetCharges(), 1, recalculateMask, &damage[0]);
4995 newAura->ApplyForTargets();
4996 }
4997 }
4998
4999 if (stealCharge)
5001 else
5003
5004 return;
5005 }
5006 else
5007 ++iter;
5008 }
5009}
bool CanBeRecalculated() const
Definition: SpellAuraEffects.h:77
int32 GetBaseAmount() const
Definition: SpellAuraEffects.h:57
void UnregisterSingleTarget()
Definition: SpellAuras.cpp:1181
bool IsPermanent() const
Definition: SpellAuras.h:139

References AURA_REMOVE_BY_ENEMY_SPELL, AuraEffect::CanBeRecalculated(), AuraEffect::GetAmount(), GetAura(), AuraEffect::GetBaseAmount(), Aura::GetCaster(), Aura::GetCasterGUID(), Aura::GetCharges(), Aura::GetDuration(), Aura::GetEffect(), Aura::GetId(), Aura::GetMaxDuration(), GetSingleCastAuras(), Aura::GetSpellInfo(), SpellInfo::HasAttribute(), IN_MILLISECONDS, Aura::IsPermanent(), Aura::IsSingleTarget(), m_ownedAuras, MAX_SPELL_EFFECTS, MINUTE, Aura::ModCharges(), Aura::ModStackAmount(), Aura::SetIsSingleTarget(), SPELL_ATTR7_DISPEL_REMOVES_CHARGES, Aura::TryRefreshStackOrCreate(), and Aura::UnregisterSingleTarget().

Referenced by Spell::EffectStealBeneficialBuff().

◆ RemoveAurasWithAttribute()

void Unit::RemoveAurasWithAttribute ( uint32  flags)
5049{
5050 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5051 {
5052 SpellInfo const* spell = iter->second->GetBase()->GetSpellInfo();
5053 if (spell->Attributes & flags)
5054 RemoveAura(iter);
5055 else
5056 ++iter;
5057 }
5058}

References SpellInfo::Attributes, m_appliedAuras, and RemoveAura().

◆ RemoveAurasWithFamily()

void Unit::RemoveAurasWithFamily ( SpellFamilyNames  family,
uint32  familyFlag1,
uint32  familyFlag2,
uint32  familyFlag3,
ObjectGuid  casterGUID 
)
5132{
5133 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5134 {
5135 Aura const* aura = iter->second->GetBase();
5136 if (!casterGUID || aura->GetCasterGUID() == casterGUID)
5137 {
5138 SpellInfo const* spell = aura->GetSpellInfo();
5139 if (spell->SpellFamilyName == uint32(family) && spell->SpellFamilyFlags.HasFlag(familyFlag1, familyFlag2, familyFlag3))
5140 {
5141 RemoveAura(iter);
5142 continue;
5143 }
5144 }
5145 ++iter;
5146 }
5147}

References Aura::GetCasterGUID(), Aura::GetSpellInfo(), flag96::HasFlag(), m_appliedAuras, RemoveAura(), SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

Referenced by spell_warl_demonic_aegis::HandleAuraApply(), and Aura::HandleAuraSpecificMods().

◆ RemoveAurasWithInterruptFlags()

void Unit::RemoveAurasWithInterruptFlags ( uint32  flag,
uint32  except = 0,
bool  isAutoshot = false 
)
5097{
5098 if (!(m_interruptMask & flag))
5099 return;
5100
5101 // interrupt auras
5102 for (AuraApplicationList::iterator iter = m_interruptableAuras.begin(); iter != m_interruptableAuras.end();)
5103 {
5104 Aura* aura = (*iter)->GetBase();
5105 ++iter;
5106 if ((aura->GetSpellInfo()->AuraInterruptFlags & flag) && (!except || aura->GetId() != except))
5107 {
5108 uint32 removedAuras = m_removedAurasCount;
5109 RemoveAura(aura);
5110 if (m_removedAurasCount > removedAuras + 1)
5111 iter = m_interruptableAuras.begin();
5112 }
5113 }
5114
5115 // interrupt channeled spell
5117 {
5118 if (spell->getState() == SPELL_STATE_CASTING && (spell->m_spellInfo->ChannelInterruptFlags & flag) && spell->m_spellInfo->Id != except)
5119 {
5120 // Do not interrupt if auto shot
5121 if (!(isAutoshot && spell->m_spellInfo->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS)))
5122 {
5123 InterruptNonMeleeSpells(false, spell->m_spellInfo->Id);
5124 }
5125 }
5126 }
5127
5129}

References SpellInfo::AuraInterruptFlags, CURRENT_CHANNELED_SPELL, Aura::GetId(), Aura::GetSpellInfo(), InterruptNonMeleeSpells(), m_currentSpells, m_interruptableAuras, m_interruptMask, m_removedAurasCount, RemoveAura(), SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS, SPELL_STATE_CASTING, and UpdateInterruptMask().

Referenced by _EnterVehicle(), AttackerStateUpdate(), ClearInPetCombat(), CombatStart(), CombatStartOnCast(), DealDamage(), Dismount(), Spell::DoAllEffectOnTarget(), Spell::DoSpellHitOnUnit(), BattlegroundWS::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerClickedOnFlag(), BattlegroundWS::EventPlayerClickedOnFlag(), BattlegroundAB::EventPlayerClickedOnFlag(), spell_rog_killing_spree::spell_rog_killing_spree_SpellScript::FilterTargets(), AuraEffect::HandleAuraModSchoolImmunity(), AuraEffect::HandleFeignDeath(), WorldSession::HandleGossipHelloOpcode(), AuraEffect::HandleModInvisibility(), AuraEffect::HandleModStealth(), AuraEffect::HandleModUnattackable(), WorldSession::HandleMovementOpcodes(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePhase(), Player::LoadFromDB(), WorldSession::LogoutPlayer(), Mount(), Spell::prepare(), ProcessTerrainStatusUpdate(), Player::SetInWater(), SetStandState(), Player::TeleportTo(), and UpdatePosition().

◆ RemoveAurasWithMechanic()

void Unit::RemoveAurasWithMechanic ( uint32  mechanic_mask,
AuraRemoveMode  removemode = AURA_REMOVE_BY_DEFAULT,
uint32  except = 0 
)
5174{
5175 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5176 {
5177 Aura const* aura = iter->second->GetBase();
5178 if (!except || aura->GetId() != except)
5179 {
5180 if (aura->GetSpellInfo()->GetAllEffectsMechanicMask() & mechanic_mask)
5181 {
5182 RemoveAura(iter, removemode);
5183 continue;
5184 }
5185 }
5186 ++iter;
5187 }
5188}

References SpellInfo::GetAllEffectsMechanicMask(), Aura::GetId(), Aura::GetSpellInfo(), m_appliedAuras, and RemoveAura().

Referenced by HandleDummyAuraProc(), AuraEffect::HandleModMechanicImmunity(), AuraEffect::HandleModStateImmunityMask(), and RemoveMovementImpairingAuras().

◆ RemoveBindSightAuras()

void Unit::RemoveBindSightAuras ( )
11153{
11155}
@ SPELL_AURA_BIND_SIGHT
Definition: SpellAuraDefines.h:64

References RemoveAurasByType(), and SPELL_AURA_BIND_SIGHT.

Referenced by RemoveFromWorld().

◆ RemoveCharmAuras()

void Unit::RemoveCharmAuras ( )
11158{
11163}
@ SPELL_AURA_MOD_POSSESS_PET
Definition: SpellAuraDefines.h:191
@ SPELL_AURA_MOD_CHARM
Definition: SpellAuraDefines.h:69
@ SPELL_AURA_AOE_CHARM
Definition: SpellAuraDefines.h:240
@ SPELL_AURA_MOD_POSSESS
Definition: SpellAuraDefines.h:65

References RemoveAurasByType(), SPELL_AURA_AOE_CHARM, SPELL_AURA_MOD_CHARM, SPELL_AURA_MOD_POSSESS, and SPELL_AURA_MOD_POSSESS_PET.

Referenced by misc_commandscript::HandleUnPossessCommand(), RemoveAllControlled(), RemoveFromWorld(), Player::StopCastingCharm(), and Creature::Update().

◆ RemoveCharmedBy()

void Unit::RemoveCharmedBy ( Unit charmer)
18691{
18692 if (!IsCharmed())
18693 return;
18694
18695 if (!charmer)
18696 charmer = GetCharmer();
18697 if (charmer != GetCharmer()) // one aura overrides another?
18698 {
18699 // LOG_FATAL("entities.unit", "Unit::RemoveCharmedBy: this: {} true charmer: {} false charmer: {}",
18700 // GetGUID().ToString(), GetCharmerGUID().ToString(), charmer->GetGUID().ToString());
18701 // ABORT();
18702 return;
18703 }
18704
18705 CharmType type;
18707 type = CHARM_TYPE_POSSESS;
18708 else if (charmer && charmer->IsOnVehicle(this))
18709 type = CHARM_TYPE_VEHICLE;
18710 else
18711 type = CHARM_TYPE_CHARM;
18712
18713 if (_oldFactionId)
18714 {
18716 _oldFactionId = 0;
18717 }
18718 else
18720
18721 CastStop();
18722 AttackStop();
18723
18724 // xinef: update speed after charming
18725 UpdateSpeed(MOVE_RUN, false);
18726
18727 // xinef: do not break any controlled motion slot
18728 if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE)
18729 {
18730 StopMoving();
18732 }
18733 // xinef: if we have any controlled movement, clear active and idle only
18734 else
18736
18738
18739 // xinef: remove stunned flag if owner was mounted
18742
18743 // If charmer still exists
18744 if (!charmer)
18745 return;
18746
18747 ASSERT(type != CHARM_TYPE_POSSESS || charmer->GetTypeId() == TYPEID_PLAYER);
18749
18750 charmer->SetCharm(this, false);
18751
18753
18754 Player* playerCharmer = charmer->ToPlayer();
18755 if (playerCharmer)
18756 {
18757 switch (type)
18758 {
18759 case CHARM_TYPE_VEHICLE:
18760 playerCharmer->SetClientControl(this, false);
18761 playerCharmer->SetClientControl(charmer, true); // verified
18764 break;
18765 case CHARM_TYPE_POSSESS:
18766 playerCharmer->SetClientControl(this, false);
18767 playerCharmer->SetClientControl(charmer, true); // verified
18772 break;
18773 case CHARM_TYPE_CHARM:
18774 if (GetTypeId() == TYPEID_UNIT && charmer->getClass() == CLASS_WARLOCK)
18775 {
18777 if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
18778 {
18780 if (GetCharmInfo())
18781 GetCharmInfo()->SetPetNumber(0, true);
18782 else
18783 LOG_ERROR("entities.unit", "Aura::HandleModCharm: target={} has a charm aura but no charm info!", GetGUID().ToString());
18784 }
18785 }
18786 break;
18787 default:
18788 break;
18789 }
18790 }
18791
18792 if (Player* player = ToPlayer())
18793 {
18794 sScriptMgr->AnticheatSetUnderACKmount(player);
18795 }
18796
18797 // xinef: restore threat
18798 for (CharmThreatMap::const_iterator itr = _charmThreatInfo.begin(); itr != _charmThreatInfo.end(); ++itr)
18799 {
18800 if (Unit* target = ObjectAccessor::GetUnit(*this, itr->first))
18801 if (!IsFriendlyTo(target))
18802 AddThreat(target, itr->second);
18803 }
18804
18805 _charmThreatInfo.clear();
18806
18807 if (Creature* creature = ToCreature())
18808 {
18809 // Vehicle should not attack its passenger after he exists the seat
18810 if (type != CHARM_TYPE_VEHICLE && charmer->IsAlive() && !charmer->IsFriendlyTo(creature))
18811 if (Attack(charmer, true))
18812 GetMotionMaster()->MoveChase(charmer);
18813
18814 // Creature will restore its old AI on next update
18815 if (creature->AI())
18816 creature->AI()->OnCharmed(false);
18817
18818 // Xinef: Remove movement flag flying
18820 }
18821 else
18822 ToPlayer()->SetClientControl(this, true); // verified
18823
18824 // a guardian should always have charminfo
18825 if (playerCharmer && this != charmer->GetFirstControlled())
18826 playerCharmer->SendRemoveControlBar();
18827
18828 // xinef: Always delete charm info (restores react state)
18831}
CharmType
Definition: Unit.h:1074
@ CHARM_TYPE_CHARM
Definition: Unit.h:1075
@ CHARM_TYPE_POSSESS
Definition: Unit.h:1076
@ CHARM_TYPE_VEHICLE
Definition: Unit.h:1077
@ UNIT_STATE_NO_ENVIRONMENT_UPD
Definition: Unit.h:353
@ MOVE_RUN
Definition: Unit.h:379
@ UNIT_FLAG_DISABLE_MOVE
Definition: Unit.h:450
@ MOTION_SLOT_CONTROLLED
Definition: MotionMaster.h:63
@ MOTION_SLOT_ACTIVE
Definition: MotionMaster.h:62
@ NULL_MOTION_TYPE
Definition: MotionMaster.h:56
@ CREATURE_TYPE_DEMON
Definition: SharedDefines.h:2602
uint32 unit_class
Definition: CreatureData.h:206
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition: Object.cpp:750
void SendRemoveControlBar()
Definition: Player.cpp:9576
void SetClientControl(Unit *target, bool allowMove, bool packetOnly=false)
Definition: Player.cpp:12744
void DeleteCharmInfo()
Definition: Unit.cpp:15707
void RestoreFaction()
Definition: Unit.cpp:18833
void SetCharm(Unit *target, bool apply)
Definition: Unit.cpp:10836
void StopAttackingInvalidTarget()
Definition: Unit.cpp:20328
void CastStop(uint32 except_spellid=0, bool withInstant=true)
Definition: Unit.cpp:1162
bool Attack(Unit *victim, bool meleeAttack)
Definition: Unit.cpp:10245
CharmThreatMap _charmThreatInfo
Definition: Unit.h:2530
void RemoveUnitMovementFlag(uint32 f)
Definition: Unit.h:2273
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition: Unit.cpp:14152
void InitDefault()
Definition: MotionMaster.cpp:86
void MovementExpiredOnSlot(MovementSlot slot, bool reset=true)
Definition: MotionMaster.h:192
void MovementExpired(bool reset=true)
Definition: MotionMaster.h:178

References _charmThreatInfo, _oldFactionId, AddThreat(), ASSERT, Attack(), AttackStop(), CastStop(), CHARM_TYPE_CHARM, CHARM_TYPE_POSSESS, CHARM_TYPE_VEHICLE, CLASS_WARLOCK, ClearUnitState(), CREATURE_TYPE_DEMON, DeleteCharmInfo(), GetCharmer(), GetCharmInfo(), getClass(), Creature::GetCreatureTemplate(), GetFirstControlled(), Object::GetGUID(), GetMotionMaster(), Object::GetTypeId(), ObjectAccessor::GetUnit(), HasUnitState(), MotionMaster::InitDefault(), IsAlive(), IsCharmed(), IsFriendlyTo(), IsGuardian(), IsOnVehicle(), IsVehicle(), LOG_ERROR, MOTION_SLOT_ACTIVE, MOTION_SLOT_CONTROLLED, MOVE_RUN, MotionMaster::MoveChase(), MotionMaster::MovementExpired(), MotionMaster::MovementExpiredOnSlot(), MOVEMENTFLAG_FLYING, NULL_MOTION_TYPE, RemoveUnitFlag(), RemoveUnitMovementFlag(), RestoreFaction(), Player::SendRemoveControlBar(), Object::SetByteValue(), SetCharm(), Player::SetClientControl(), SetFaction(), CharmInfo::SetPetNumber(), sScriptMgr, StopAttackingInvalidTarget(), StopMoving(), Object::ToCreature(), Object::ToPlayer(), Position::ToString(), CreatureTemplate::type, TYPEID_PLAYER, TYPEID_UNIT, CreatureTemplate::unit_class, UNIT_FIELD_BYTES_0, UNIT_FLAG_DISABLE_MOVE, UNIT_FLAG_POSSESSED, UNIT_FLAG_STUNNED, UNIT_STATE_NO_ENVIRONMENT_UPD, UNIT_STATE_POSSESSED, UNIT_STATE_STUNNED, and UpdateSpeed().

Referenced by AuraEffect::HandleCharmConvert(), AuraEffect::HandleModCharm(), AuraEffect::HandleModPossess(), AuraEffect::HandleModPossessPet(), Puppet::RemoveFromWorld(), and Vehicle::RemovePassenger().

◆ RemoveComboPointHolder()

void Unit::RemoveComboPointHolder ( Unit unit)
inline
2300{ m_ComboPointHolders.erase(unit); }

References m_ComboPointHolders.

Referenced by AddComboPoints(), and ClearComboPoints().

◆ RemoveDynObject()

bool Unit::RemoveDynObject ( uint32  spellId)
6054{
6055 if (m_dynObj.empty())
6056 return false;
6057
6058 bool result = false;
6059 for (DynObjectList::iterator i = m_dynObj.begin(); i != m_dynObj.end();)
6060 {
6061 DynamicObject* dynObj = *i;
6062 if (dynObj->GetSpellId() == spellId)
6063 {
6064 dynObj->Remove();
6065 i = m_dynObj.begin();
6066 result = true;
6067 }
6068 else
6069 ++i;
6070 }
6071
6072 return result;
6073}
void Remove()
Definition: DynamicObject.cpp:189

References DynamicObject::GetSpellId(), m_dynObj, and DynamicObject::Remove().

Referenced by Spell::cancel(), Spell::EffectAddFarsight(), and spell_item_shifting_naaru_silver::OnBaseRemove().

◆ RemoveEvadeAuras()

void Unit::RemoveEvadeAuras ( )
5358{
5359 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5360 {
5361 Aura const* aura = iter->second->GetBase();
5362 SpellInfo const* spellInfo = aura->GetSpellInfo();
5364 ++iter;
5365 else
5367 }
5368
5369 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5370 {
5371 Aura* aura = iter->second;
5372 SpellInfo const* spellInfo = aura->GetSpellInfo();
5374 ++iter;
5375 else
5377 }
5378}
@ SPELL_AURA_CLONE_CASTER
Definition: SpellAuraDefines.h:310
@ SPELL_ATTR0_CU_IGNORE_EVADE
Definition: SpellInfo.h:187

References _UnapplyAura(), AURA_REMOVE_BY_DEFAULT, GetOwnerGUID(), Aura::GetSpellInfo(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), Aura::IsPassive(), Object::IsPlayer(), m_appliedAuras, m_ownedAuras, RemoveOwnedAura(), SPELL_ATTR0_CU_IGNORE_EVADE, SPELL_AURA_CLONE_CASTER, and SPELL_AURA_CONTROL_VEHICLE.

Referenced by CreatureAI::_EnterEvadeMode(), and npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode().

◆ RemoveExtraUnitMovementFlag()

void Unit::RemoveExtraUnitMovementFlag ( uint16  f)
inline

◆ removeFollower()

void Unit::removeFollower ( FollowerReference )
inline
2260{ /* nothing to do yet */ }

Referenced by FollowerReference::targetObjectDestroyLink().

◆ RemoveFromWorld()

void Unit::RemoveFromWorld ( )
overridevirtual

Reimplemented from WorldObject.

15584{
15585 // cleanup
15586 ASSERT(GetGUID());
15587
15588 if (IsInWorld())
15589 {
15591 if (IsVehicle())
15593
15597
15600
15601 ExitVehicle(); // Remove applied auras with SPELL_AURA_CONTROL_VEHICLE
15604
15606
15607 if (GetCharmerGUID())
15608 {
15609 LOG_FATAL("entities.unit", "Unit {} has charmer guid when removed from world", GetEntry());
15610 ABORT();
15611 }
15612
15613 if (Unit* owner = GetOwner())
15614 {
15615 if (owner->m_Controlled.find(this) != owner->m_Controlled.end())
15616 {
15618 owner->SetMinion((Minion*)this, false);
15619 LOG_INFO("entities.unit", "Unit {} is in controlled list of {} when removed from world", GetEntry(), owner->GetEntry());
15620 //ABORT();
15621 }
15622 }
15623
15626 }
15627}
void RemoveFromWorld() override
Definition: Object.cpp:1182
void RemoveNotOwnSingleTargetAuras()
Definition: Unit.cpp:5060
void UnsummonAllTotems(bool onDeath=false)
Definition: Unit.cpp:11165
void RemoveAllDynObjects()
Definition: Unit.cpp:6075
void RemoveAreaAurasDueToLeaveWorld()
Definition: Unit.cpp:5206
void RemoveBindSightAuras()
Definition: Unit.cpp:11152
void RemoveAllControlled(bool onDeath=false)
Definition: Unit.cpp:11046

References ABORT, ASSERT, ExitVehicle(), GetCharmerGUID(), Object::GetEntry(), Object::GetGUID(), GetOwner(), HasUnitTypeMask(), Object::IsInWorld(), IsVehicle(), LOG_FATAL, LOG_INFO, m_duringRemoveFromWorld, RemoveAllControlled(), RemoveAllDynObjects(), RemoveAllGameObjects(), RemoveAreaAurasDueToLeaveWorld(), RemoveBindSightAuras(), RemoveCharmAuras(), WorldObject::RemoveFromWorld(), RemoveNotOwnSingleTargetAuras(), RemoveVehicleKit(), UNIT_MASK_GUARDIAN, UNIT_MASK_MINION, and UnsummonAllTotems().

Referenced by CleanupBeforeRemoveFromMap(), Creature::RemoveFromWorld(), Pet::RemoveFromWorld(), and Player::RemoveFromWorld().

◆ RemoveGameObject() [1/2]

void Unit::RemoveGameObject ( GameObject gameObj,
bool  del 
)
6110{
6111 if (!gameObj || gameObj->GetOwnerGUID() != GetGUID())
6112 return;
6113
6115
6116 for (uint8 i = 0; i < MAX_GAMEOBJECT_SLOT; ++i)
6117 {
6118 if (m_ObjectSlot[i] == gameObj->GetGUID())
6119 {
6120 m_ObjectSlot[i].Clear();
6121 break;
6122 }
6123 }
6124
6125 // GO created by some spell
6126 if (uint32 spellid = gameObj->GetSpellId())
6127 {
6128 RemoveAurasDueToSpell(spellid);
6129
6130 if (GetTypeId() == TYPEID_PLAYER)
6131 {
6132 SpellInfo const* createBySpell = sSpellMgr->GetSpellInfo(spellid);
6133 // Need activate spell use for owner
6134 if (createBySpell && createBySpell->IsCooldownStartedOnEvent())
6135 // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
6136 ToPlayer()->SendCooldownEvent(createBySpell);
6137 }
6138 }
6139
6140 m_gameObj.remove(gameObj->GetGUID());
6141
6142 if (del)
6143 {
6144 gameObj->SetRespawnTime(0);
6145 gameObj->Delete();
6146 }
6147}
void Clear()
Definition: ObjectGuid.h:140
void SendCooldownEvent(SpellInfo const *spellInfo, uint32 itemId=0, Spell *spell=nullptr, bool setCooldown=true)
Definition: Player.cpp:10999

References ObjectGuid::Clear(), GameObject::Delete(), ObjectGuid::Empty, Object::GetGUID(), GameObject::GetOwnerGUID(), GameObject::GetSpellId(), Object::GetTypeId(), SpellInfo::IsCooldownStartedOnEvent(), m_gameObj, m_ObjectSlot, MAX_GAMEOBJECT_SLOT, RemoveAurasDueToSpell(), Player::SendCooldownEvent(), GameObject::SetOwnerGUID(), GameObject::SetRespawnTime(), sSpellMgr, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by Spell::cancel(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), Spell::EffectSummonObject(), gobject_commandscript::HandleGameObjectDeleteCommand(), spell_warl_demonic_circle_summon::HandleRemove(), boss_kologarn::boss_kologarnAI::JustDied(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::JustDied(), boss_ahune::boss_ahuneAI::JustDied(), npc_midsummer_bonfire::npc_midsummer_bonfire(), npc_ulduar_harpoonfirestate::npc_ulduar_harpoonfirestateAI::SetData(), GameObject::Update(), and npc_death_knight_initiate::npc_death_knight_initiateAI::UpdateAI().

◆ RemoveGameObject() [2/2]

void Unit::RemoveGameObject ( uint32  spellid,
bool  del 
)
6150{
6151 if (m_gameObj.empty())
6152 return;
6153
6154 for (GameObjectList::iterator itr = m_gameObj.begin(); itr != m_gameObj.end();)
6155 {
6156 if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr))
6157 {
6158 if (spellid > 0 && go->GetSpellId() != spellid)
6159 {
6160 ++itr;
6161 continue;
6162 }
6163
6164 go->SetOwnerGUID(ObjectGuid::Empty);
6165 if(del)
6166 {
6167 go->SetRespawnTime(0);
6168 go->Delete();
6169 }
6170 }
6171 m_gameObj.erase(itr++);
6172 }
6173}

References ObjectGuid::Empty, ObjectAccessor::GetGameObject(), and m_gameObj.

◆ removeHatedBy()

void Unit::removeHatedBy ( HostileReference )
inline
2148{ /* nothing to do yet */ }

Referenced by HostileReference::targetObjectDestroyLink().

◆ RemoveMovementImpairingAuras()

void Unit::RemoveMovementImpairingAuras ( bool  withRoot)
5150{
5151 if (withRoot)
5153
5154 // Snares
5155 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5156 {
5157 Aura const* aura = iter->second->GetBase();
5158 if (aura->GetSpellInfo()->Mechanic == MECHANIC_SNARE)
5159 {
5160 RemoveAura(iter);
5161 continue;
5162 }
5163
5164 // Xinef: turn off snare auras by setting amount to 0 :)
5165 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
5166 if (((1 << i) & iter->second->GetEffectMask()) && aura->GetSpellInfo()->Effects[i].Mechanic == MECHANIC_SNARE)
5167 aura->GetEffect(i)->ChangeAmount(0);
5168
5169 ++iter;
5170 }
5171}
void ChangeAmount(int32 newAmount, bool mark=true, bool onStackOrReapply=false)
Definition: SpellAuraEffects.cpp:702

References AuraEffect::ChangeAmount(), SpellInfo::Effects, Aura::GetEffect(), Aura::GetSpellInfo(), m_appliedAuras, MAX_SPELL_EFFECTS, SpellInfo::Mechanic, MECHANIC_ROOT, MECHANIC_SNARE, RemoveAura(), and RemoveAurasWithMechanic().

Referenced by Spell::CheckCast(), Spell::EffectTriggerSpell(), HandleDummyAuraProc(), AuraEffect::HandleModMechanicImmunity(), and spell_gen_remove_impairing_auras::HandleScriptEffect().

◆ RemoveNotOwnSingleTargetAuras()

void Unit::RemoveNotOwnSingleTargetAuras ( )
5061{
5062 // single target auras from other casters
5063 // Iterate m_ownedAuras - aura is marked as single target in Unit::AddAura (and pushed to m_ownedAuras).
5064 // m_appliedAuras will NOT contain the aura before first Unit::Update after adding it to m_ownedAuras.
5065 // Quickly removing such an aura will lead to it not being unregistered from caster's single cast auras container
5066 // leading to assertion failures if the aura was cast on a player that can
5067 // (and is changing map at the point where this function is called).
5068 // Such situation occurs when player is logging in inside an instance and fails the entry check for any reason.
5069 // The aura that was loaded from db (indirectly, via linked casts) gets removed before it has a chance
5070 // to register in m_appliedAuras
5071 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5072 {
5073 Aura const* aura = iter->second;
5074
5075 if (aura->GetCasterGUID() != GetGUID() && aura->IsSingleTarget())
5076 RemoveOwnedAura(iter);
5077 else
5078 ++iter;
5079 }
5080
5081 // single target auras at other targets
5082 AuraList& scAuras = GetSingleCastAuras();
5083 for (AuraList::iterator iter = scAuras.begin(); iter != scAuras.end();)
5084 {
5085 Aura* aura = *iter;
5086 if (aura->GetUnitOwner() != this)
5087 {
5088 aura->Remove();
5089 iter = scAuras.begin();
5090 }
5091 else
5092 ++iter;
5093 }
5094}

References Aura::GetCasterGUID(), Object::GetGUID(), GetSingleCastAuras(), Aura::GetUnitOwner(), Aura::IsSingleTarget(), m_ownedAuras, Aura::Remove(), and RemoveOwnedAura().

Referenced by RemoveFromWorld().

◆ RemoveNpcFlag()

void Unit::RemoveNpcFlag ( NPCFlags  flags)
inline
1648{ RemoveFlag(UNIT_NPC_FLAGS, flags); }

References Object::RemoveFlag(), and UNIT_NPC_FLAGS.

Referenced by Vehicle::AddPassenger(), boss_vaelastrasz::boss_vaelAI::BeginSpeech(), npc_riggle_bassbait::npc_riggle_bassbaitAI::CheckTournamentState(), npc_fos_leader::npc_fos_leaderAI::DoAction(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), anchorite_karja::anchorite_karjaAI::DoAction(), exarch_orelis::exarch_orelisAI::DoAction(), npc_precious::npc_preciousAI::EnterCombat(), npc_artorius::npc_artoriusAI::EnterCombat(), npc_simone::npc_simoneAI::EnterCombat(), npc_nelson::npc_nelsonAI::EnterCombat(), npc_franklin::npc_franklinAI::EnterCombat(), spell_q12096_q12092_dummy::spell_q12096_q12092_dummy_SpellScript::HandleDummy(), npc_fos_leader_second::npc_fos_leader_secondAI::npc_fos_leader_secondAI(), npc_pos_leader_second::npc_pos_leader_secondAI::npc_pos_leader_secondAI(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), npc_announcer_toc10::OnGossipHello(), boss_doomrel::OnGossipSelect(), boss_majordomo::OnGossipSelect(), npc_zulaman_hostage::OnGossipSelect(), npc_arthas::OnGossipSelect(), adyen_the_lightbringer::OnGossipSelect(), npc_announcer_toc5::OnGossipSelect(), npc_announcer_toc10::OnGossipSelect(), npc_hor_leader::OnGossipSelect(), npc_ulduar_expedition_commander::OnGossipSelect(), npc_thrall_old_hillsbrad::OnGossipSelect(), npc_hor_leader_second::OnGossipSelect(), npc_battle_at_valhalas::OnQuestAccept(), npc_riggle_bassbait::OnQuestReward(), NPCStaveQuestAI::PrepareForEncounter(), RemoveVehicleKit(), boss_majordomo::boss_majordomoAI::Reset(), npc_arthas::npc_arthasAI::Reset(), npc_plucky::npc_pluckyAI::Reset(), npc_xerestrasza::npc_xerestraszaAI::Reset(), npc_tirion_fordring_tft::npc_tirion_fordringAI::Reset(), npc_thassarian2::npc_thassarian2AI::Reset(), npc_lake_frog::npc_lake_frogAI::Reset(), npc_akama_shade::npc_akamaAI::Reset(), npc_aeranas::npc_aeranasAI::Reset(), npc_chicken_cluck::npc_chicken_cluckAI::Reset(), hyjalAI::Retreat(), npc_tirion_fordring_tft::npc_tirion_fordringAI::sGossipSelect(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::sGossipSelect(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::sGossipSelect(), boss_apothecary_hummel::boss_apothecary_hummelAI::sGossipSelect(), boss_victor_nefarius::boss_victor_nefariusAI::sGossipSelect(), npc_harrison_jones::npc_harrison_jonesAI::sGossipSelect(), npc_thassarian2::npc_thassarian2AI::sGossipSelect(), npc_akama_shade::npc_akamaAI::sGossipSelect(), npc_general_andorov::sGossipSelect(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::SpellHit(), npc_belnistrasz::npc_belnistraszAI::sQuestAccept(), npc_shay_leafrunner::npc_shay_leafrunnerAI::sQuestAccept(), hyjalAI::StartEvent(), npc_cork_gizelton::npc_cork_gizeltonAI::SummonHelpers(), npc_plucky::npc_pluckyAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_lake_frog::npc_lake_frogAI::UpdateAI(), npc_crusade_recruit::npc_crusade_recruitAI::UpdateAI(), and socrethar::socretharAI::UpdateAI().

◆ RemoveOwnedAura() [1/3]

void Unit::RemoveOwnedAura ( Aura aura,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4671{
4672 if (aura->IsRemoved())
4673 return;
4674
4675 ASSERT(aura->GetOwner() == this);
4676
4677 uint32 spellId = aura->GetId();
4678 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
4679
4680 for (AuraMap::iterator itr = range.first; itr != range.second; ++itr)
4681 {
4682 if (itr->second == aura)
4683 {
4684 RemoveOwnedAura(itr, removeMode);
4685 return;
4686 }
4687 }
4688
4689 ABORT();
4690}

References ABORT, ASSERT, Aura::GetId(), Aura::GetOwner(), Aura::IsRemoved(), m_ownedAuras, and RemoveOwnedAura().

◆ RemoveOwnedAura() [2/3]

void Unit::RemoveOwnedAura ( AuraMap::iterator &  i,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)

◆ RemoveOwnedAura() [3/3]

void Unit::RemoveOwnedAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4659{
4660 for (AuraMap::iterator itr = m_ownedAuras.lower_bound(spellId); itr != m_ownedAuras.upper_bound(spellId);)
4661 if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!casterGUID || itr->second->GetCasterGUID() == casterGUID))
4662 {
4663 RemoveOwnedAura(itr, removeMode);
4664 itr = m_ownedAuras.lower_bound(spellId);
4665 }
4666 else
4667 ++itr;
4668}

References m_ownedAuras, and RemoveOwnedAura().

◆ RemoveOwnedAuras() [1/2]

void Unit::RemoveOwnedAuras ( std::function< bool(Aura const *)> const &  check)
4784{
4785 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
4786 {
4787 if (check(iter->second))
4788 {
4789 RemoveOwnedAura(iter);
4790 continue;
4791 }
4792 ++iter;
4793 }
4794}

References m_ownedAuras, and RemoveOwnedAura().

◆ RemoveOwnedAuras() [2/2]

void Unit::RemoveOwnedAuras ( uint32  spellId,
std::function< bool(Aura const *)> const &  check 
)
4810{
4811 for (AuraMap::iterator iter = m_ownedAuras.lower_bound(spellId); iter != m_ownedAuras.upper_bound(spellId);)
4812 {
4813 if (check(iter->second))
4814 {
4815 RemoveOwnedAura(iter);
4816 continue;
4817 }
4818 ++iter;
4819 }
4820}

References m_ownedAuras, and RemoveOwnedAura().

◆ RemovePetAura()

void Unit::RemovePetAura ( PetAura const *  petSpell)
17444{
17445 if (GetTypeId() != TYPEID_PLAYER)
17446 return;
17447
17448 m_petAuras.erase(petSpell);
17449 if (Pet* pet = ToPlayer()->GetPet())
17450 pet->RemoveAurasDueToSpell(petSpell->GetAura(pet->GetEntry()));
17451 if (Unit* charm = GetCharm())
17452 charm->RemoveAurasDueToSpell(petSpell->GetAura(charm->GetEntry()));
17453}

References PetAura::GetAura(), GetCharm(), Object::GetTypeId(), m_petAuras, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by Player::_removeTalentAurasAndSpells(), Pet::CastPetAuras(), AuraEffect::HandleAuraDummy(), and Player::removeSpell().

◆ RemovePlayerFromVision()

void Unit::RemovePlayerFromVision ( Player player)
11142{
11143 m_sharedVision.remove(player);
11144 player->m_isInSharedVisionOf.erase(this);
11145 if (m_sharedVision.empty())
11146 {
11147 setActive(false);
11148 SetWorldObject(false);
11149 }
11150}

References Player::m_isInSharedVisionOf, m_sharedVision, WorldObject::setActive(), and WorldObject::SetWorldObject().

Referenced by Player::SetViewpoint(), and Player::~Player().

◆ RemovePointedBy()

void Unit::RemovePointedBy ( SafeUnitPointer sup)
inline

◆ RemoveStandFlags()

void Unit::RemoveStandFlags ( uint8  flags)
inline
@ UNIT_BYTES_1_OFFSET_VIS_FLAG
Definition: Unit.h:46
void RemoveByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition: Object.cpp:930

References Object::RemoveByteFlag(), UNIT_BYTES_1_OFFSET_VIS_FLAG, and UNIT_FIELD_BYTES_1.

Referenced by AuraEffect::HandleModStealth(), Player::InitStatsForLevel(), and npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI().

◆ RemoveUnitFlag()

void Unit::RemoveUnitFlag ( UnitFlags  flags)
inline
1482{ RemoveFlag(UNIT_FIELD_FLAGS, flags); }

References Object::RemoveFlag(), and UNIT_FIELD_FLAGS.

Referenced by spell_the_lich_king_trigger_vile_spirit::spell_the_lich_king_trigger_vile_spirit_SpellScript::ActivateSpirit(), Player::BuildPlayerRepop(), boss_thekal::boss_thekalAI::CheckPhaseTransition(), Player::CleanupAfterTaxiFlight(), ClearInCombat(), ClearInPetCombat(), DisableRotate(), boss_thorim::boss_thorimAI::DisableThorim(), Dismount(), boss_thekal::boss_thekalAI::DoAction(), npc_twilight_volunteer::DoAction(), boss_taldaram::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), npc_living_constellation::npc_living_constellationAI::DoAction(), boss_broggok::boss_broggokAI::DoAction(), boss_cthun::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), npc_xt002_heart::npc_xt002_heartAI::DoAction(), npc_massive_jormungar::npc_massive_jormungarAI::DoAction(), npc_ferocious_rhino::npc_ferocious_rhinoAI::DoAction(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::DoAction(), npc_frenzied_worgen::npc_frenzied_worgenAI::DoAction(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DoAction(), boss_essence_of_desire::boss_essence_of_desireAI::DoAction(), boss_essence_of_anger::boss_essence_of_angerAI::DoAction(), boss_the_lurker_below::boss_the_lurker_belowAI::DoAction(), npc_naga_distiller::npc_naga_distillerAI::DoAction(), boss_kelidan_the_breaker::boss_kelidan_the_breakerAI::DoAction(), boss_ichoron::boss_ichoronAI::DoExplodeCompleted(), HomeMovementGenerator< Creature >::DoFinalize(), FlightPathMovementGenerator::DoFinalize(), FleeingMovementGenerator< T >::DoFinalize(), ConfusedMovementGenerator< T >::DoFinalize(), WorldSession::DoLootRelease(), Spell::EffectResurrectPet(), Spell::EffectSkinning(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::EnableSara(), boss_ymiron::boss_ymironAI::EnterCombat(), boss_bronjahm::boss_bronjahmAI::EnterEvadeMode(), npc_ghostly_priest::npc_ghostly_priestAI::EnterEvadeMode(), npc_phantom_mage::npc_phantom_mageAI::EnterEvadeMode(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::EnterEvadeMode(), npc_spectral_footman::npc_spectral_footmanAI::EnterEvadeMode(), npc_tortured_rifleman::npc_tortured_riflemanAI::EnterEvadeMode(), boss_kelthuzad::boss_kelthuzadAI::EnterEvadeMode(), boss_malygos::boss_malygosAI::EnterEvadeMode(), boss_ymiron::boss_ymironAI::EnterEvadeMode(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::EnterEvadeMode(), npc_future_you::npc_future_youAI::EnterEvadeMode(), SACActivateEvent::Execute(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::FeignDeath(), TimedFleeingMovementGenerator::Finalize(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), AuraEffect::HandleArenaPreparation(), AuraEffect::HandleAuraModFaction(), AuraEffect::HandleAuraModPacify(), AuraEffect::HandleAuraModSilence(), spell_q13007_iron_colossus::spell_q13007_iron_colossus_SpellScript::HandleDummy(), spell_gen_model_visible::HandleEffectRemove(), boss_ragnaros::boss_ragnarosAI::HandleEmerge(), AuraEffect::HandleFeignDeath(), WorldSession::HandleLogoutCancelOpcode(), spell_oculus_drake_flag::spell_oculus_drake_flagAuraScript::HandleOnEffectApply(), spell_oculus_rider_aura::spell_oculus_rider_auraAuraScript::HandleOnEffectRemove(), WorldSession::HandlePlayerLoginToCharInWorld(), spell_boss_magus_telestra_summon_telestra_clones::spell_boss_magus_telestra_summon_telestra_clones_AuraScript::HandleRemove(), boss_vaelastrasz::boss_vaelAI::Initialize(), boss_jarien::IsSummonedBy(), boss_sothos::IsSummonedBy(), boss_apothecary_hummel::boss_apothecary_hummelAI::JustDied(), boss_volazj::JustDied(), boss_ichoron::boss_ichoronAI::JustDied(), boss_illidan_stormrage::boss_illidan_stormrageAI::JustDied(), boss_taerar::boss_taerarAI::JustDied(), boss_noth::boss_nothAI::JustDied(), boss_kaelthas::boss_kaelthasAI::JustDied(), boss_hazzarah::JustSummoned(), boss_nalorakk::boss_nalorakkAI::MoveInLineOfSight(), boss_anubarak_trial::boss_anubarak_trialAI::MoveInLineOfSight(), boss_taldaram::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), boss_kaelthas::boss_kaelthasAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_amanitar_mushrooms::npc_amanitar_mushrooms(), npc_giant_infernal::npc_giant_infernalAI::npc_giant_infernalAI(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), instance_dire_maul::instance_dire_maul_InstanceMapScript::OnCreatureCreate(), npc_death_knight_initiate::OnGossipSelect(), npc_bessy::OnQuestAccept(), spell_halion_twilight_phasing::spell_halion_twilight_phasing_AuraScript::OnRemove(), spell_alar_ember_blast_death::spell_alar_ember_blast_death_AuraScript::OnRemove(), boss_nefarian::PathEndReached(), RemoveCharmedBy(), Vehicle::RemovePassenger(), boss_keristrasza::boss_keristraszaAI::RemovePrison(), boss_lord_valthalak::boss_lord_valthalakAI::Reset(), boss_rend_blackhand::boss_rend_blackhandAI::Reset(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_ragnaros::boss_ragnarosAI::Reset(), boss_mr_smite::boss_mr_smiteAI::Reset(), npc_mograine::npc_mograineAI::Reset(), boss_felmyst::boss_felmystAI::Reset(), boss_kalecgos::boss_kalecgosAI::Reset(), boss_muru::boss_muruAI::Reset(), boss_eye_of_cthun::Reset(), boss_volazj::Reset(), boss_anub_arak::boss_anub_arakAI::Reset(), boss_general_zarithrian::boss_general_zarithrianAI::Reset(), boss_grand_champion::boss_grand_championAI::Reset(), boss_novos::boss_novosAI::Reset(), boss_bronjahm::boss_bronjahmAI::Reset(), boss_drakkari_colossus::boss_drakkari_colossusAI::Reset(), boss_professor_putricide::boss_professor_putricideAI::Reset(), boss_gothik::boss_gothikAI::Reset(), boss_kelthuzad::boss_kelthuzadAI::Reset(), boss_malygos::boss_malygosAI::Reset(), npc_crystalline_frayer::npc_crystalline_frayerAI::Reset(), boss_eregos::boss_eregosAI::Reset(), boss_urom::boss_uromAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_loken::boss_lokenAI::Reset(), boss_sjonnir::boss_sjonnirAI::Reset(), boss_flame_leviathan::boss_flame_leviathanAI::Reset(), boss_mimiron::boss_mimironAI::Reset(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::Reset(), boss_xt002::boss_xt002AI::Reset(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::Reset(), boss_svala::boss_svalaAI::Reset(), boss_ymiron::boss_ymironAI::Reset(), boss_ichoron::boss_ichoronAI::Reset(), npc_wounded_skirmisher::Reset(), npc_venture_co_straggler::npc_venture_co_stragglerAI::Reset(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::Reset(), boss_kaelthas::boss_kaelthasAI::Reset(), emerald_dragonAI::Reset(), npc_doctor::npc_doctorAI::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), Resurrect(), SetCharm(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::SetData(), npc_ulduar_vx001::npc_ulduar_vx001AI::SetData(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::SetData(), Pet::setDeathState(), SetImmuneToNPC(), SetImmuneToPC(), Player::SetIsSpectator(), SetStunned(), SetSwim(), Battlefield::ShowNpc(), boss_zuljin::boss_zuljinAI::SpawnAdds(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::SpellHit(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::SpellHit(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::SpellHit(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::SpellHit(), npc_ulduar_vx001::npc_ulduar_vx001AI::SpellHit(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::SpellHit(), npc_infernal_attacker::npc_infernal_attackerAI::SpellHit(), npc_draenei_survivor::npc_draenei_survivorAI::SpellHit(), npc_nether_drake::npc_nether_drakeAI::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), boss_headless_horseman_head::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), npc_rinji::npc_rinjiAI::sQuestAccept(), instance_violet_hold::instance_violet_hold_InstanceMapScript::StartBossEncounter(), boss_lord_valthalak::boss_lord_valthalakAI::StartFighting(), boss_noth::boss_nothAI::StartGroundPhase(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_dorothee::boss_dorotheeAI::UpdateAI(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_mograine::npc_mograineAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), boss_akilzon::boss_akilzonAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), npc_giant_infernal::npc_giant_infernalAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_volazj::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), npc_memory::npc_memoryAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_novos::boss_novosAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_crystalline_frayer::npc_crystalline_frayerAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_loken::boss_lokenAI::UpdateAI(), npc_hol_monument::npc_hol_monumentAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_flame_leviathan::boss_flame_leviathanAI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_shade_of_akama::boss_shade_of_akamaAI::UpdateAI(), boss_the_lurker_below::boss_the_lurker_belowAI::UpdateAI(), boss_ahune::boss_ahuneAI::UpdateAI(), boss_magtheridon::boss_magtheridonAI::UpdateAI(), boss_grand_warlock_nethekurse::boss_grand_warlock_nethekurseAI::UpdateAI(), boss_kaelthas::boss_kaelthasAI::UpdateAI(), socrethar::socretharAI::UpdateAI(), boss_taerar::boss_taerarAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_injured_patient::npc_injured_patientAI::UpdateAI(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::WaypointReached(), and npc_general_andorov::WaypointReached().

◆ RemoveUnitFlag2()

◆ RemoveUnitMovementFlag()

◆ RemoveVehicleKit()

◆ RemoveVisibleAura()

void Unit::RemoveVisibleAura ( uint8  slot)
inline
2160{ m_visibleAuras.erase(slot); UpdateAuraForGroup(slot);}
void UpdateAuraForGroup(uint8 slot)
Definition: Unit.cpp:17314

References m_visibleAuras, and UpdateAuraForGroup().

Referenced by AuraApplication::_Remove().

◆ ReplaceAllDynamicFlags()

◆ ReplaceAllNpcFlags()

void Unit::ReplaceAllNpcFlags ( NPCFlags  flags)
inline
1649{ SetUInt32Value(UNIT_NPC_FLAGS, flags); }

References Object::SetUInt32Value(), and UNIT_NPC_FLAGS.

Referenced by Pet::CreateBaseAtTamed(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), Spell::EffectSummonType(), SmartAI::EndPath(), modify_commandscript::HandleModifyFactionCommand(), npc_commandscript::HandleNpcSetFlagCommand(), npc_lord_arete::npc_lord_areteAI::InitializeAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustRespawned(), npc_akama_illidan::npc_akama_illidanAI::JustSummoned(), Pet::LoadPetFromDB(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npc_ulduar_keeper::OnGossipSelect(), npc_shandy_dalaran::OnGossipSelect(), go_crystalline_tear::OnQuestAccept(), npc_hidden_cultist::npc_hidden_cultistAI::PreScript(), boss_doomrel::boss_doomrelAI::Reset(), npc_eris_hevenfire::npc_eris_hevenfireAI::Reset(), npc_taretha::npc_tarethaAI::Reset(), brann_bronzebeard::brann_bronzebeardAI::Reset(), npc_hidden_cultist::npc_hidden_cultistAI::Reset(), npc_pet_gen_argent_pony_bridle::Reset(), Creature::setDeathState(), npc_eris_hevenfire::npc_eris_hevenfireAI::SetGUID(), npc_captain_saeed::npc_captain_saeedAI::SetGUID(), npc_akama_illidan::npc_akama_illidanAI::sGossipSelect(), npc_escortAI::Start(), FollowerAI::StartFollow(), SmartAI::StartPath(), Player::SummonPet(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), npc_pet_gen_argent_pony_bridle::UpdateAI(), Creature::UpdateEntry(), brann_bronzebeard::brann_bronzebeardAI::UpdateEscortAI(), npc_captain_saeed::npc_captain_saeedAI::WaypointReached(), and npc_akama_illidan::npc_akama_illidanAI::WaypointReached().

◆ ReplaceAllUnitFlags()

◆ ReplaceAllUnitFlags2()

void Unit::ReplaceAllUnitFlags2 ( UnitFlags2  flags)
inline

◆ resetAttackTimer()

void Unit::resetAttackTimer ( WeaponAttackType  type = BASE_ATTACK)

◆ ResetRedirectThreat()

◆ RestoreDisplayId()

void Unit::RestoreDisplayId ( )
16921{
16922 AuraEffect* handledAura = nullptr;
16923 AuraEffect* handledAuraForced = nullptr;
16924 // try to receive model from transform auras
16926 if (!transforms.empty())
16927 {
16928 // iterate over already applied transform auras - from newest to oldest
16929 for (auto i = transforms.rbegin(); i != transforms.rend(); ++i)
16930 {
16931 if (AuraApplication const* aurApp = (*i)->GetBase()->GetApplicationOfTarget(GetGUID()))
16932 {
16933 if (!handledAura)
16934 handledAura = (*i);
16935 // xinef: prefer negative/forced auras
16936 if ((*i)->GetSpellInfo()->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) || !aurApp->IsPositive())
16937 {
16938 handledAuraForced = (*i);
16939 break;
16940 }
16941 }
16942 }
16943 }
16944
16945 // Xinef: include clone auras (eg mirror images)
16946 if (!handledAuraForced && !handledAura)
16947 {
16949 if (!cloneAuras.empty())
16950 for (Unit::AuraEffectList::const_iterator i = cloneAuras.begin(); i != cloneAuras.end(); ++i)
16951 handledAura = *i;
16952 }
16953
16955
16956 // xinef: order of execution is important!
16957 // first forced transform auras, then shapeshifts, then normal transform
16958 // transform aura was found
16959 if (handledAuraForced)
16960 {
16961 handledAuraForced->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true);
16962 return;
16963 }
16964 else if (!shapeshiftAura.empty()) // we've found shapeshift
16965 {
16966 // only one such aura possible at a time
16967 if (uint32 modelId = GetModelForForm(GetShapeshiftForm(), shapeshiftAura.front()->GetId()))
16968 {
16969 SetDisplayId(modelId);
16970 return;
16971 }
16972 }
16973 else if (handledAura)
16974 {
16975 handledAura->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true);
16976 return;
16977 }
16978
16979 // no auras found - set modelid to default
16981}
@ SPELL_AURA_MOD_SHAPESHIFT
Definition: SpellAuraDefines.h:99
@ AURA_EFFECT_HANDLE_SEND_FOR_CLIENT
Definition: SpellAuraDefines.h:43
uint32 GetModelForForm(ShapeshiftForm form, uint32 spellId) const
Definition: Unit.cpp:19339
void HandleEffect(AuraApplication *aurApp, uint8 mode, bool apply)
Definition: SpellAuraEffects.cpp:735

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, Aura::GetApplicationOfTarget(), GetAuraEffectsByType(), AuraApplication::GetBase(), Object::GetGUID(), GetModelForForm(), GetNativeDisplayId(), GetShapeshiftForm(), AuraEffect::HandleEffect(), SetDisplayId(), SPELL_ATTR0_NO_IMMUNITIES, SPELL_AURA_CLONE_CASTER, SPELL_AURA_MOD_SHAPESHIFT, and SPELL_AURA_TRANSFORM.

Referenced by AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraTransform(), spell_gen_aura_service_uniform::OnRemove(), and Player::SetIsSpectator().

◆ RestoreFaction()

void Unit::RestoreFaction ( )
18834{
18835 if (GetTypeId() == TYPEID_PLAYER)
18837 else
18838 {
18840 {
18841 if (Unit* owner = GetOwner())
18842 {
18843 SetFaction(owner->GetFaction());
18844 return;
18845 }
18846 }
18847
18848 if (CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate()) // normal creature
18849 SetFaction(cinfo->faction);
18850 }
18851}
void SetFactionForRace(uint8 race)
Definition: Player.cpp:5750

References GetOwner(), getRace(), Object::GetTypeId(), HasUnitTypeMask(), SetFaction(), Player::SetFactionForRace(), Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, and UNIT_MASK_MINION.

Referenced by npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), npc_calvin_montague::npc_calvin_montagueAI::DamageTaken(), boss_thekal::boss_thekalAI::DoAction(), AuraEffect::HandleAuraModFaction(), npc_commandscript::HandleNpcSetOriginalFaction(), npc_shay_leafrunner::npc_shay_leafrunnerAI::InitializeAI(), npc_escortAI::JustRespawned(), SmartAI::JustRespawned(), npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::JustSummoned(), RemoveCharmedBy(), npc_death_knight_initiate::npc_death_knight_initiateAI::Reset(), npc_crusade_persuaded::npc_crusade_persuadedAI::Reset(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::Reset(), npc_calvin_montague::npc_calvin_montagueAI::Reset(), boss_azuregos::boss_azuregosAI::Reset(), npc_ahnqiraji_critter::Reset(), npc_hidden_cultist::npc_hidden_cultistAI::Reset(), npc_captain_saeed::npc_captain_saeedAI::Reset(), npc_bessy::npc_bessyAI::Reset(), npc_raliq_the_drunk::npc_raliq_the_drunkAI::Reset(), npc_salsalabim::npc_salsalabimAI::Reset(), npc_isla_starmane::npc_isla_starmaneAI::Reset(), and boss_servant_quarters::UpdateAI().

◆ ResumeMovement()

void Unit::ResumeMovement ( uint32  timer = 0,
uint8  slot = 0 
)
16829{
16830 if (slot >= MAX_MOTION_SLOT)
16831 return;
16832
16833 if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(slot))
16834 movementGenerator->Resume(timer);
16835}

References GetMotionMaster(), and MAX_MOTION_SLOT.

◆ RewardRage()

void Unit::RewardRage ( uint32  damage,
uint32  weaponSpeedHitFactor,
bool  attacker 
)
20264{
20265 float addRage;
20266
20267 float rageconversion = ((0.0091107836f * GetLevel() * GetLevel()) + 3.225598133f * GetLevel()) + 4.2652911f;
20268
20269 // Unknown if correct, but lineary adjust rage conversion above level 70
20270 if (GetLevel() > 70)
20271 rageconversion += 13.27f * (GetLevel() - 70);
20272
20273 if (attacker)
20274 {
20275 addRage = (damage / rageconversion * 7.5f + weaponSpeedHitFactor) / 2;
20276
20277 // talent who gave more rage on attack
20279 }
20280 else
20281 {
20282 addRage = damage / rageconversion * 2.5f;
20283
20284 // Berserker Rage effect
20285 if (HasAura(18499))
20286 addRage *= 3.0f;
20287 }
20288
20289 addRage *= sWorld->getRate(RATE_POWER_RAGE_INCOME);
20290
20291 ModifyPower(POWER_RAGE, uint32(addRage * 10));
20292}
@ SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT
Definition: SpellAuraDefines.h:276
@ RATE_POWER_RAGE_INCOME
Definition: IWorld.h:420

References AddPct(), GetLevel(), GetTotalAuraModifier(), HasAura(), ModifyPower(), POWER_RAGE, RATE_POWER_RAGE_INCOME, SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT, and sWorld.

Referenced by DealDamage().

◆ RollMeleeOutcomeAgainst() [1/2]

MeleeHitOutcome Unit::RollMeleeOutcomeAgainst ( Unit const *  victim,
WeaponAttackType  attType 
) const
2744{
2745 // This is only wrapper
2746
2747 // Miss chance based on melee
2748 //float miss_chance = MeleeMissChanceCalc(victim, attType);
2749 float miss_chance = MeleeSpellMissChance(victim, attType, int32(GetWeaponSkillValue(attType, victim)) - int32(victim->GetMaxSkillValueForLevel(this)), 0);
2750
2751 // Critical hit chance
2752 float crit_chance = GetUnitCriticalChance(attType, victim);
2753 if( crit_chance < 0 )
2754 crit_chance = 0;
2755
2756 float dodge_chance = victim->GetUnitDodgeChance();
2757 float block_chance = victim->GetUnitBlockChance();
2758 float parry_chance = victim->GetUnitParryChance();
2759
2760 // Useful if want to specify crit & miss chances for melee, else it could be removed
2761 //LOG_DEBUG("entities.unit", "MELEE OUTCOME: miss {} crit {} dodge {} parry {} block {}", miss_chance, crit_chance, dodge_chance, parry_chance, block_chance);
2762
2763 return RollMeleeOutcomeAgainst(victim, attType, int32(crit_chance * 100), int32(miss_chance * 100), int32(dodge_chance * 100), int32(parry_chance * 100), int32(block_chance * 100));
2764}
float GetUnitCriticalChance(WeaponAttackType attackType, Unit const *victim) const
Definition: Unit.cpp:3681

References GetMaxSkillValueForLevel(), GetUnitBlockChance(), GetUnitCriticalChance(), GetUnitDodgeChance(), GetUnitParryChance(), GetWeaponSkillValue(), MeleeSpellMissChance(), and RollMeleeOutcomeAgainst().

Referenced by CalculateMeleeDamage(), and RollMeleeOutcomeAgainst().

◆ RollMeleeOutcomeAgainst() [2/2]

MeleeHitOutcome Unit::RollMeleeOutcomeAgainst ( Unit const *  victim,
WeaponAttackType  attType,
int32  crit_chance,
int32  miss_chance,
int32  dodge_chance,
int32  parry_chance,
int32  block_chance 
) const
2767{
2768 if (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsEvadingAttacks())
2769 {
2770 return MELEE_HIT_EVADE;
2771 }
2772
2773 int32 attackerMaxSkillValueForLevel = GetMaxSkillValueForLevel(victim);
2774 int32 victimMaxSkillValueForLevel = victim->GetMaxSkillValueForLevel(this);
2775
2776 int32 attackerWeaponSkill = GetWeaponSkillValue(attType, victim);
2777 int32 victimDefenseSkill = victim->GetDefenseSkillValue(this);
2778
2779 sScriptMgr->OnBeforeRollMeleeOutcomeAgainst(this, victim, attType, attackerMaxSkillValueForLevel, victimMaxSkillValueForLevel, attackerWeaponSkill, victimDefenseSkill, crit_chance, miss_chance, dodge_chance, parry_chance, block_chance);
2780
2781 // bonus from skills is 0.04%
2782 int32 skillBonus = 4 * (attackerWeaponSkill - victimMaxSkillValueForLevel);
2783 int32 sum = 0, tmp = 0;
2784 int32 roll = urand (0, 10000);
2785
2786 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: skill bonus of {} for attacker", skillBonus);
2787 //LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: rolled {}, miss {}, dodge {}, parry {}, block {}, crit {}",
2788 // roll, miss_chance, dodge_chance, parry_chance, block_chance, crit_chance);
2789
2790 tmp = miss_chance;
2791
2792 if (tmp > 0 && roll < (sum += tmp))
2793 {
2794 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: MISS");
2795 return MELEE_HIT_MISS;
2796 }
2797
2798 // Dodge chance
2799
2800 // only players can't dodge if attacker is behind
2801 if (victim->GetTypeId() == TYPEID_PLAYER && !victim->HasInArc(M_PI, this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
2802 {
2803 //LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: attack came from behind and victim was a player.");
2804 }
2805 // Xinef: do not allow to dodge with CREATURE_FLAG_EXTRA_NO_DODGE flag
2806 else if (victim->GetTypeId() == TYPEID_PLAYER || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_DODGE))
2807 {
2808 // Reduce dodge chance by attacker expertise rating
2809 if (GetTypeId() == TYPEID_PLAYER)
2810 dodge_chance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100);
2811 else
2812 dodge_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE) * 25;
2813
2814 // Modify dodge chance by attacker SPELL_AURA_MOD_COMBAT_RESULT_CHANCE
2816 dodge_chance = int32 (float (dodge_chance) * GetTotalAuraMultiplier(SPELL_AURA_MOD_ENEMY_DODGE));
2817
2818 tmp = dodge_chance;
2819
2820 // xinef: if casting or stunned - cant dodge
2821 if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
2822 tmp = 0;
2823
2824 if ((tmp > 0) // check if unit _can_ dodge
2825 && ((tmp -= skillBonus) > 0)
2826 && roll < (sum += tmp))
2827 {
2828 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: DODGE <{}, {})", sum - tmp, sum);
2829 return MELEE_HIT_DODGE;
2830 }
2831 }
2832
2833 // parry & block chances
2834
2835 // check if attack comes from behind, nobody can parry or block if attacker is behind
2836 if (!victim->HasInArc(M_PI, this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
2837 {
2838 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: attack came from behind.");
2839 }
2840 else
2841 {
2842 // Reduce parry chance by attacker expertise rating
2843 if (GetTypeId() == TYPEID_PLAYER)
2844 parry_chance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100);
2845 else
2846 parry_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE) * 25;
2847
2848 if (victim->GetTypeId() == TYPEID_PLAYER || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY))
2849 {
2850 tmp = parry_chance;
2851
2852 // xinef: cant parry while casting or while stunned
2853 if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
2854 tmp = 0;
2855
2856 if (tmp > 0 // check if unit _can_ parry
2857 && (tmp -= skillBonus) > 0
2858 && roll < (sum += tmp))
2859 {
2860 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: PARRY <{}, {})", sum - tmp, sum);
2861 return MELEE_HIT_PARRY;
2862 }
2863 }
2864
2865 if (victim->GetTypeId() == TYPEID_PLAYER || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK))
2866 {
2867 tmp = block_chance;
2868
2869 // xinef: cant block while casting or while stunned
2870 if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
2871 tmp = 0;
2872
2873 if (tmp > 0 // check if unit _can_ block
2874 && (tmp -= skillBonus) > 0
2875 && roll < (sum += tmp))
2876 {
2877 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: BLOCK <{}, {})", sum - tmp, sum);
2878 return MELEE_HIT_BLOCK;
2879 }
2880 }
2881 }
2882
2883 // Max 40% chance to score a glancing blow against mobs that are higher level (can do only players and pets and not with ranged weapon)
2884 if (attType != RANGED_ATTACK &&
2885 (GetTypeId() == TYPEID_PLAYER || IsPet()) &&
2886 victim->GetTypeId() != TYPEID_PLAYER && !victim->IsPet() &&
2887 GetLevel() < victim->getLevelForTarget(this))
2888 {
2889 // cap possible value (with bonuses > max skill)
2890 int32 skill = attackerWeaponSkill;
2891 int32 maxskill = attackerMaxSkillValueForLevel;
2892 skill = (skill > maxskill) ? maxskill : skill;
2893
2894 tmp = (10 + (victimDefenseSkill - skill)) * 100;
2895 tmp = tmp > 4000 ? 4000 : tmp;
2896 if (roll < (sum += tmp))
2897 {
2898 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: GLANCING <{}, {})", sum - 4000, sum);
2899 return MELEE_HIT_GLANCING;
2900 }
2901 }
2902
2903 // mobs can score crushing blows if they're 4 or more levels above victim
2904 if (getLevelForTarget(victim) >= victim->getLevelForTarget(this) + 4 &&
2905 // can be from by creature (if can) or from controlled player that considered as creature
2907 !(GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSHING_BLOWS))
2908 {
2909 // when their weapon skill is 15 or more above victim's defense skill
2910 tmp = victimDefenseSkill;
2911 int32 tmpmax = victimMaxSkillValueForLevel;
2912 // having defense above your maximum (from items, talents etc.) has no effect
2913 tmp = tmp > tmpmax ? tmpmax : tmp;
2914 // tmp = mob's level * 5 - player's current defense skill
2915 tmp = attackerMaxSkillValueForLevel - tmp;
2916 if (tmp >= 15)
2917 {
2918 // add 2% chance per lacking skill point, min. is 15%
2919 tmp = tmp * 200 - 1500;
2920 if (roll < (sum += tmp))
2921 {
2922 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: CRUSHING <{}, {})", sum - tmp, sum);
2923 return MELEE_HIT_CRUSHING;
2924 }
2925 }
2926 }
2927
2928 // Critical chance
2929 tmp = crit_chance;
2930
2931 if (tmp > 0 && roll < (sum += tmp))
2932 {
2933 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: CRIT <{}, {})", sum - tmp, sum);
2934 if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRIT))
2935 {
2936 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: CRIT DISABLED)");
2937 }
2938 else
2939 return MELEE_HIT_CRIT;
2940 }
2941
2942 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: NORMAL");
2943 return MELEE_HIT_NORMAL;
2944}
@ CREATURE_FLAG_EXTRA_NO_CRUSHING_BLOWS
Definition: CreatureData.h:54
@ CREATURE_FLAG_EXTRA_NO_CRIT
Definition: CreatureData.h:66

References CREATURE_FLAG_EXTRA_NO_BLOCK, CREATURE_FLAG_EXTRA_NO_CRIT, CREATURE_FLAG_EXTRA_NO_CRUSHING_BLOWS, CREATURE_FLAG_EXTRA_NO_DODGE, CREATURE_FLAG_EXTRA_NO_PARRY, CreatureTemplate::flags_extra, Creature::GetCreatureTemplate(), GetDefenseSkillValue(), GetLevel(), getLevelForTarget(), GetMaxSkillValueForLevel(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscValue(), GetTotalAuraMultiplier(), Object::GetTypeId(), GetWeaponSkillValue(), HasAuraType(), Position::HasInArc(), HasUnitState(), IsControlledByPlayer(), Creature::IsEvadingAttacks(), IsNonMeleeSpellCast(), IsPet(), LOG_DEBUG, MELEE_HIT_BLOCK, MELEE_HIT_CRIT, MELEE_HIT_CRUSHING, MELEE_HIT_DODGE, MELEE_HIT_EVADE, MELEE_HIT_GLANCING, MELEE_HIT_MISS, MELEE_HIT_NORMAL, MELEE_HIT_PARRY, RANGED_ATTACK, SPELL_AURA_IGNORE_HIT_DIRECTION, SPELL_AURA_MOD_COMBAT_RESULT_CHANCE, SPELL_AURA_MOD_ENEMY_DODGE, SPELL_AURA_MOD_EXPERTISE, sScriptMgr, Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, UNIT_STATE_CONTROLLED, urand(), and VICTIMSTATE_DODGE.

◆ Say() [1/2]

◆ Say() [2/2]

void Unit::Say ( uint32  textId,
WorldObject const *  target = nullptr 
)
virtual

Reimplemented in Player.

21307{
21308 Talk(textId, CHAT_MSG_MONSTER_SAY, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), target);
21309}

References CHAT_MSG_MONSTER_SAY, CONFIG_LISTEN_RANGE_SAY, and sWorld.

◆ SelectNearbyNoTotemTarget()

Unit * Unit::SelectNearbyNoTotemTarget ( Unit exclude = nullptr,
float  dist = NOMINAL_MELEE_RANGE 
) const
17165{
17166 std::list<Unit*> targets;
17167 Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck u_check(this, this, dist);
17169 Cell::VisitAllObjects(this, searcher, dist);
17170
17171 // remove current target
17172 if (GetVictim())
17173 targets.remove(GetVictim());
17174
17175 if (exclude)
17176 targets.remove(exclude);
17177
17178 // remove not LoS targets
17179 for (std::list<Unit*>::iterator tIter = targets.begin(); tIter != targets.end();)
17180 {
17181 if (!IsWithinLOSInMap(*tIter) || !IsValidAttackTarget(*tIter))
17182 {
17183 std::list<Unit*>::iterator tIter2 = tIter;
17184 ++tIter;
17185 targets.erase(tIter2);
17186 }
17187 else
17188 ++tIter;
17189 }
17190
17191 // no appropriate targets
17192 if (targets.empty())
17193 return nullptr;
17194
17195 // select random
17197}
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition: Containers.h:135
bool IsValidAttackTarget(Unit const *target, SpellInfo const *bySpell=nullptr) const
Definition: Unit.cpp:13781
Definition: GridNotifiers.h:420

References GetVictim(), IsValidAttackTarget(), WorldObject::IsWithinLOSInMap(), Acore::Containers::SelectRandomContainerElement(), and Cell::VisitAllObjects().

Referenced by spell_rog_blade_flurry::CheckProc(), and spell_warr_sweeping_strikes::CheckProc().

◆ SelectNearbyTarget()

Unit * Unit::SelectNearbyTarget ( Unit exclude = nullptr,
float  dist = NOMINAL_MELEE_RANGE 
) const
17130{
17131 std::list<Unit*> targets;
17132 Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, this, dist);
17134 Cell::VisitAllObjects(this, searcher, dist);
17135
17136 // remove current target
17137 if (GetVictim())
17138 targets.remove(GetVictim());
17139
17140 if (exclude)
17141 targets.remove(exclude);
17142
17143 // remove not LoS targets
17144 for (std::list<Unit*>::iterator tIter = targets.begin(); tIter != targets.end();)
17145 {
17146 if (!IsWithinLOSInMap(*tIter) || !IsValidAttackTarget(*tIter))
17147 {
17148 std::list<Unit*>::iterator tIter2 = tIter;
17149 ++tIter;
17150 targets.erase(tIter2);
17151 }
17152 else
17153 ++tIter;
17154 }
17155
17156 // no appropriate targets
17157 if (targets.empty())
17158 return nullptr;
17159
17160 // select random
17162}
Definition: GridNotifiers.h:858

References GetVictim(), IsValidAttackTarget(), WorldObject::IsWithinLOSInMap(), Acore::Containers::SelectRandomContainerElement(), and Cell::VisitAllObjects().

Referenced by npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_curator::boss_curatorAI::JustSummoned(), npc_hodirs_fury::npc_hodirs_furyAI::UpdateAI(), npc_storm_beacon_spawn::npc_storm_beacon_spawnAI::UpdateAI(), boss_kologarn::boss_kologarnAI::UpdateAI(), boss_thorim_trap::boss_thorim_trapAI::UpdateAI(), npc_llod_generic::npc_llod_genericAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), Player::UpdateCharmedAI(), and boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::UpdateEscortAI().

◆ SendAttackStateUpdate() [1/2]

void Unit::SendAttackStateUpdate ( CalcDamageInfo damageInfo)

Probably used for debugging purposes, as it is not known to appear on retail servers

6392{
6393 LOG_DEBUG("entities.unit", "WORLD: Sending SMSG_ATTACKERSTATEUPDATE");
6394
6395 uint32 tmpDamage[MAX_ITEM_PROTO_DAMAGES] = { };
6396 uint32 tmpAbsorb[MAX_ITEM_PROTO_DAMAGES] = { };
6397 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
6398 {
6399 //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop
6400 tmpDamage[i] = damageInfo->damages[i].damage;
6401 tmpAbsorb[i] = damageInfo->damages[i].absorb;
6402 if (damageInfo->target->GetTypeId() == TYPEID_PLAYER && damageInfo->target->ToPlayer()->GetCommandStatus(CHEAT_GOD))
6403 {
6404 tmpAbsorb[i] = tmpDamage[i];
6405 tmpDamage[i] = 0;
6406 }
6407 }
6408
6409 uint32 count = 1;
6410 if (tmpDamage[1] || tmpAbsorb[1] || damageInfo->damages[1].resist)
6411 {
6412 ++count;
6413 }
6414
6415 size_t const maxsize = 4 + 5 + 5 + 4 + 4 + 1 + count * (4 + 4 + 4 + 4 + 4) + 1 + 4 + 4 + 4 + 4 + 4 * 12;
6416 WorldPacket data(SMSG_ATTACKERSTATEUPDATE, maxsize); // we guess size
6417 data << uint32(damageInfo->HitInfo);
6418 data << damageInfo->attacker->GetPackGUID();
6419 data << damageInfo->target->GetPackGUID();
6420 data << uint32(tmpDamage[0] + tmpDamage[1]); // Full damage
6421 int32 overkill = tmpDamage[0] + tmpDamage[1] - damageInfo->target->GetHealth();
6422 data << uint32(overkill < 0 ? 0 : overkill); // Overkill
6423 data << uint8(count); // Sub damage count
6424
6425 for (uint32 i = 0; i < count; ++i)
6426 {
6427 data << uint32(damageInfo->damages[i].damageSchoolMask); // School of sub damage
6428 data << float(tmpDamage[i]); // sub damage
6429 data << uint32(tmpDamage[i]); // Sub Damage
6430 }
6431
6433 {
6434 for (uint32 i = 0; i < count; ++i)
6435 {
6436 data << uint32(tmpAbsorb[i]); // Absorb
6437 }
6438 }
6439
6441 {
6442 for (uint32 i = 0; i < count; ++i)
6443 {
6444 data << uint32(damageInfo->damages[i].resist); // Resist
6445 }
6446 }
6447
6448 data << uint8(damageInfo->TargetState);
6449 data << uint32(0); // Unknown attackerstate
6450 data << uint32(0); // Melee spellid
6451
6452 if (damageInfo->HitInfo & HITINFO_BLOCK)
6453 data << uint32(damageInfo->blocked_amount);
6454
6455 if (damageInfo->HitInfo & HITINFO_RAGE_GAIN)
6456 data << uint32(0);
6457
6459 if (damageInfo->HitInfo & HITINFO_UNK1)
6460 {
6461 data << uint32(0);
6462 data << float(0);
6463 data << float(0);
6464 data << float(0);
6465 data << float(0);
6466 data << float(0);
6467 data << float(0);
6468 data << float(0);
6469 data << float(0);
6470 data << float(0); // Found in a loop with 1 iteration
6471 data << float(0); // ditto ^
6472 data << uint32(0);
6473 }
6474
6475 SendMessageToSet(&data, true);
6476}
@ HITINFO_RAGE_GAIN
Definition: Unit.h:203
@ HITINFO_UNK1
Definition: Unit.h:180
@ SMSG_ATTACKERSTATEUPDATE
Definition: Opcodes.h:360

References CalcDamageInfo::absorb, CalcDamageInfo::attacker, CalcDamageInfo::blocked_amount, CHEAT_GOD, CalcDamageInfo::damage, CalcDamageInfo::damages, CalcDamageInfo::damageSchoolMask, Player::GetCommandStatus(), GetHealth(), Object::GetPackGUID(), Object::GetTypeId(), CalcDamageInfo::HitInfo, HITINFO_BLOCK, HITINFO_FULL_ABSORB, HITINFO_FULL_RESIST, HITINFO_PARTIAL_ABSORB, HITINFO_PARTIAL_RESIST, HITINFO_RAGE_GAIN, HITINFO_UNK1, LOG_DEBUG, MAX_ITEM_PROTO_DAMAGES, CalcDamageInfo::resist, WorldObject::SendMessageToSet(), SMSG_ATTACKERSTATEUPDATE, CalcDamageInfo::target, CalcDamageInfo::TargetState, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by AttackerStateUpdate(), misc_commandscript::HandleDamageCommand(), spell_dk_dancing_rune_weapon::HandleProc(), and SendAttackStateUpdate().

◆ SendAttackStateUpdate() [2/2]

void Unit::SendAttackStateUpdate ( uint32  HitInfo,
Unit target,
uint8  SwingType,
SpellSchoolMask  damageSchoolMask,
uint32  Damage,
uint32  AbsorbDamage,
uint32  Resist,
VictimState  TargetState,
uint32  BlockedAmount 
)
6479{
6480 CalcDamageInfo dmgInfo;
6481 dmgInfo.HitInfo = HitInfo;
6482 dmgInfo.attacker = this;
6483 dmgInfo.target = target;
6484
6485 dmgInfo.damages[0].damage = Damage - AbsorbDamage - Resist - BlockedAmount;
6486 dmgInfo.damages[0].damageSchoolMask = damageSchoolMask;
6487 dmgInfo.damages[0].absorb = AbsorbDamage;
6488 dmgInfo.damages[0].resist = Resist;
6489
6490 dmgInfo.damages[1].damage = 0;
6491 dmgInfo.damages[1].damageSchoolMask = 0;
6492 dmgInfo.damages[1].absorb = 0;
6493 dmgInfo.damages[1].resist = 0;
6494
6495 dmgInfo.TargetState = TargetState;
6496 dmgInfo.blocked_amount = BlockedAmount;
6497 SendAttackStateUpdate(&dmgInfo);
6498}
HitInfo
Definition: Unit.h:178

References CalcDamageInfo::absorb, CalcDamageInfo::attacker, CalcDamageInfo::blocked_amount, CalcDamageInfo::damage, CalcDamageInfo::damages, CalcDamageInfo::damageSchoolMask, CalcDamageInfo::HitInfo, CalcDamageInfo::resist, SendAttackStateUpdate(), CalcDamageInfo::target, and CalcDamageInfo::TargetState.

◆ SendChangeCurrentVictimOpcode()

void Unit::SendChangeCurrentVictimOpcode ( HostileReference pHostileReference)
20226{
20227 if (!GetThreatMgr().isThreatListEmpty())
20228 {
20229 uint32 count = GetThreatMgr().GetThreatList().size();
20230
20231 LOG_DEBUG("entities.unit", "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message");
20232 WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8);
20233 data << GetPackGUID();
20234 data << pHostileReference->getUnitGuid().WriteAsPacked();
20235 data << uint32(count);
20237 for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
20238 {
20239 data << (*itr)->getUnitGuid().WriteAsPacked();
20240 data << uint32((*itr)->GetThreat() * 100);
20241 }
20242 SendMessageToSet(&data, false);
20243 }
20244}
@ SMSG_HIGHEST_THREAT_UPDATE
Definition: Opcodes.h:1184
std::list< HostileReference * > StorageType
Definition: ThreatMgr.h:148
PackedGuid WriteAsPacked() const
Definition: ObjectGuid.h:318

References Object::GetPackGUID(), ThreatMgr::GetThreatList(), GetThreatMgr(), HostileReference::getUnitGuid(), LOG_DEBUG, WorldObject::SendMessageToSet(), SMSG_HIGHEST_THREAT_UPDATE, and ObjectGuid::WriteAsPacked().

Referenced by ThreatMgr::setCurrentVictim().

◆ SendClearTarget()

void Unit::SendClearTarget ( )
20438{
20440 data << GetPackGUID();
20441 SendMessageToSet(&data, false);
20442}
@ SMSG_BREAK_TARGET
Definition: Opcodes.h:368

References Object::GetPackGUID(), WorldObject::SendMessageToSet(), and SMSG_BREAK_TARGET.

Referenced by Vehicle::AddPassenger(), and Spell::EffectForceDeselect().

◆ SendClearThreatListOpcode()

void Unit::SendClearThreatListOpcode ( )
20247{
20248 LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_CLEAR Message");
20250 data << GetPackGUID();
20251 SendMessageToSet(&data, false);
20252}
@ SMSG_THREAT_CLEAR
Definition: Opcodes.h:1187

References Object::GetPackGUID(), LOG_DEBUG, WorldObject::SendMessageToSet(), and SMSG_THREAT_CLEAR.

Referenced by ThreatMgr::ClearAllThreat().

◆ SendComboPoints()

void Unit::SendComboPoints ( )
17027{
17028 if (m_cleanupDone)
17029 {
17030 return;
17031 }
17032
17034 if (Player* playerMe = ToPlayer())
17035 {
17036 WorldPacket data(SMSG_UPDATE_COMBO_POINTS, packGUID.size() + 1);
17037 data << packGUID;
17038 data << uint8(m_comboPoints);
17039 playerMe->SendDirectMessage(&data);
17040 }
17041
17042 ObjectGuid ownerGuid = GetCharmerOrOwnerGUID();
17043 Player* owner = nullptr;
17044 if (ownerGuid.IsPlayer())
17045 {
17046 owner = ObjectAccessor::GetPlayer(*this, ownerGuid);
17047 }
17048
17049 if (m_movedByPlayer || owner)
17050 {
17051 WorldPacket data(SMSG_PET_UPDATE_COMBO_POINTS, GetPackGUID().size() + packGUID.size() + 1);
17052 data << GetPackGUID();
17053 data << packGUID;
17054 data << uint8(m_comboPoints);
17055
17056 if (m_movedByPlayer)
17058
17059 if (owner && owner != m_movedByPlayer)
17060 owner->SendDirectMessage(&data);
17061 }
17062}
@ SMSG_PET_UPDATE_COMBO_POINTS
Definition: Opcodes.h:1200
@ SMSG_UPDATE_COMBO_POINTS
Definition: Opcodes.h:955
Definition: ObjectGuid.h:265
std::size_t size() const
Definition: ObjectGuid.h:276

References GetCharmerOrOwnerGUID(), Object::GetPackGUID(), ObjectAccessor::GetPlayer(), ObjectGuid::IsPlayer(), m_cleanupDone, m_comboPoints, m_comboTarget, m_movedByPlayer, Player::SendDirectMessage(), PackedGuid::size(), SMSG_PET_UPDATE_COMBO_POINTS, SMSG_UPDATE_COMBO_POINTS, and Object::ToPlayer().

Referenced by AddComboPoints(), and ClearComboPoints().

◆ SendEnergizeSpellLog()

void Unit::SendEnergizeSpellLog ( Unit victim,
uint32  SpellID,
uint32  Damage,
Powers  powertype 
)
11217{
11218 WorldPacket data(SMSG_SPELLENERGIZELOG, (8 + 8 + 4 + 4 + 4 + 1));
11219 data << victim->GetPackGUID();
11220 data << GetPackGUID();
11221 data << uint32(spellID);
11222 data << uint32(powerType);
11223 data << uint32(damage);
11224 SendMessageToSet(&data, true);
11225}
@ SMSG_SPELLENERGIZELOG
Definition: Opcodes.h:367

References Object::GetPackGUID(), WorldObject::SendMessageToSet(), and SMSG_SPELLENERGIZELOG.

Referenced by EnergizeBySpell(), and AuraEffect::HandlePeriodicTriggerSpellAuraTick().

◆ SendHealSpellLog()

void Unit::SendHealSpellLog ( Unit victim,
uint32  SpellID,
uint32  Damage,
uint32  OverHeal,
uint32  Absorb,
bool  critical = false 
)
11188{
11189 // we guess size
11190 WorldPacket data(SMSG_SPELLHEALLOG, (8 + 8 + 4 + 4 + 4 + 4 + 1 + 1));
11191 data << victim->GetPackGUID();
11192 data << GetPackGUID();
11193 data << uint32(SpellID);
11194 data << uint32(Damage);
11195 data << uint32(OverHeal);
11196 data << uint32(Absorb); // Absorb amount
11197 data << uint8(critical ? 1 : 0);
11198 data << uint8(0); // unused
11199 SendMessageToSet(&data, true);
11200}
@ SMSG_SPELLHEALLOG
Definition: Opcodes.h:366

References Object::GetPackGUID(), WorldObject::SendMessageToSet(), and SMSG_SPELLHEALLOG.

Referenced by HealBySpell().

◆ SendMeleeAttackStart()

void Unit::SendMeleeAttackStart ( Unit victim,
Player sendTo = nullptr 
)
3024{
3025 WorldPacket data(SMSG_ATTACKSTART, 8 + 8);
3026 data << GetGUID();
3027 data << victim->GetGUID();
3028 if (sendTo)
3029 sendTo->SendDirectMessage(&data);
3030 else
3031 SendMessageToSet(&data, true);
3032 LOG_DEBUG("entities.unit", "WORLD: Sent SMSG_ATTACKSTART");
3033}
@ SMSG_ATTACKSTART
Definition: Opcodes.h:353

References Object::GetGUID(), LOG_DEBUG, Player::SendDirectMessage(), WorldObject::SendMessageToSet(), and SMSG_ATTACKSTART.

Referenced by Attack(), and Player::GetInitialVisiblePackets().

◆ SendMeleeAttackStop()

void Unit::SendMeleeAttackStop ( Unit victim = nullptr)

Can also take the value 0x01, which seems related to updating rotation

3036{
3037 // pussywizard: calling SendMeleeAttackStop without clearing UNIT_STATE_MELEE_ATTACKING and then AttackStart the same player may spoil npc rotating!
3038 // pussywizard: this happens in some boss scripts, just add clearing here
3039 // ClearUnitState(UNIT_STATE_MELEE_ATTACKING); // commented out for now
3040
3041 WorldPacket data(SMSG_ATTACKSTOP, (8 + 8 + 4));
3042 data << GetPackGUID();
3043 data << (victim ? victim->GetPackGUID() : PackedGuid());
3044 data << uint32(0);
3045 SendMessageToSet(&data, true);
3046 LOG_DEBUG("entities.unit", "WORLD: Sent SMSG_ATTACKSTOP");
3047
3048 if (victim)
3049 LOG_DEBUG("entities.unit", "{} {} stopped attacking {} {}", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUID().ToString(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), victim->GetGUID().ToString());
3050 else
3051 LOG_DEBUG("entities.unit", "{} {} stopped attacking", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUID().ToString());
3052}
@ SMSG_ATTACKSTOP
Definition: Opcodes.h:354

References Object::GetGUID(), Object::GetPackGUID(), Object::GetTypeId(), LOG_DEBUG, WorldObject::SendMessageToSet(), SMSG_ATTACKSTOP, ObjectGuid::ToString(), Position::ToString(), and TYPEID_PLAYER.

Referenced by Attack(), AttackStop(), boss_garfrost::boss_garfrostAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), spell_svalna_revive_champion::spell_svalna_revive_champion_SpellScript::Land(), SetControlled(), boss_razorscale::boss_razorscaleAI::SpellHit(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), and boss_kaelthas::boss_kaelthasAI::UpdateAI().

◆ SendMonsterMove()

void Unit::SendMonsterMove ( float  NewPosX,
float  NewPosY,
float  NewPosZ,
uint32  TransitTime,
SplineFlags  sf = SPLINEFLAG_WALK_MODE 
)
557{
558 WorldPacket data(SMSG_MONSTER_MOVE, 1 + 12 + 4 + 1 + 4 + 4 + 4 + 12 + GetPackGUID().size());
559 data << GetPackGUID();
560
561 data << uint8(0); // new in 3.1
562 data << GetPositionX() << GetPositionY() << GetPositionZ();
563 data << GameTime::GetGameTimeMS().count();
564 data << uint8(0);
565 data << uint32(sf);
566 data << TransitTime; // Time in between points
567 data << uint32(1); // 1 single waypoint
568 data << NewPosX << NewPosY << NewPosZ; // the single waypoint Point B
569
570 SendMessageToSet(&data, true);
571}
@ SMSG_MONSTER_MOVE
Definition: Opcodes.h:251

References GameTime::GetGameTimeMS(), Object::GetPackGUID(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::SendMessageToSet(), and SMSG_MONSTER_MOVE.

Referenced by npc_ulduar_magnetic_core::npc_ulduar_magnetic_coreAI::npc_ulduar_magnetic_coreAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), and boss_yoggsaron_sara::boss_yoggsaron_saraAI::UpdateAI().

◆ SendMovementFeatherFall()

void Unit::SendMovementFeatherFall ( Player sendTo)
20868{
20869 if (!movespline->Initialized())
20870 return;
20872 data << GetPackGUID();
20873 sendTo->SendDirectMessage(&data);
20874}
@ SMSG_SPLINE_MOVE_FEATHER_FALL
Definition: Opcodes.h:803

References Object::GetPackGUID(), Movement::MoveSpline::Initialized(), movespline, Player::SendDirectMessage(), and SMSG_SPLINE_MOVE_FEATHER_FALL.

Referenced by Player::GetAurasForTarget().

◆ SendMovementFlagUpdate()

void Unit::SendMovementFlagUpdate ( bool  self = false)
16853{
16854 WorldPacket data;
16855 BuildHeartBeatMsg(&data);
16856 SendMessageToSet(&data, self);
16857}
void BuildHeartBeatMsg(WorldPacket *data) const
Definition: Object.cpp:2048

References BuildHeartBeatMsg(), and WorldObject::SendMessageToSet().

Referenced by npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), debug_commandscript::HandleDebugMoveflagsCommand(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), boss_harbinger_skyriss::boss_harbinger_skyrissAI::JustSummoned(), MotionMaster::MoveFall(), npc_twilight_volunteer::MovementInform(), boss_felmyst::boss_felmystAI::MovementInform(), npc_eoe_wyrmrest_skytalon::npc_eoe_wyrmrest_skytalonAI::PassengerBoarded(), boss_sister_svalna::boss_sister_svalnaAI::Reset(), npc_dancing_flames::npc_dancing_flamesAI::Reset(), SetCharm(), SetHover(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), boss_koralon::boss_koralonAI::UpdateAI(), boss_kaelthas::boss_kaelthasAI::UpdateAI(), and Player::UpdateCharmedAI().

◆ SendMovementHover()

void Unit::SendMovementHover ( Player sendTo)
20905{
20906 if (!movespline->Initialized())
20907 return;
20909 data << GetPackGUID();
20910 sendTo->SendDirectMessage(&data);
20911}
@ SMSG_SPLINE_MOVE_SET_HOVER
Definition: Opcodes.h:805

References Object::GetPackGUID(), Movement::MoveSpline::Initialized(), movespline, Player::SendDirectMessage(), and SMSG_SPLINE_MOVE_SET_HOVER.

Referenced by Player::GetAurasForTarget().

◆ SendMovementWaterWalking()

void Unit::SendMovementWaterWalking ( Player sendTo)
20846{
20847 if (!movespline->Initialized())
20848 return;
20850 data << GetPackGUID();
20851 sendTo->SendDirectMessage(&data);
20852}
@ SMSG_SPLINE_MOVE_WATER_WALK
Definition: Opcodes.h:807

References Object::GetPackGUID(), Movement::MoveSpline::Initialized(), movespline, Player::SendDirectMessage(), and SMSG_SPLINE_MOVE_WATER_WALK.

Referenced by Player::GetAurasForTarget().

◆ SendPeriodicAuraLog()

void Unit::SendPeriodicAuraLog ( SpellPeriodicAuraLogInfo pInfo)
6302{
6303 AuraEffect const* aura = pInfo->auraEff;
6305 data << GetPackGUID();
6306 data << aura->GetCasterGUID().WriteAsPacked();
6307 data << uint32(aura->GetId()); // spellId
6308 data << uint32(1); // count
6309 data << uint32(aura->GetAuraType()); // auraId
6310 switch (aura->GetAuraType())
6311 {
6314 {
6315 //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop
6316 uint32 damage = pInfo->damage;
6317 uint32 absorb = pInfo->absorb;
6318 if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetCommandStatus(CHEAT_GOD))
6319 {
6320 absorb = damage;
6321 damage = 0;
6322 }
6323
6324 data << uint32(damage); // damage
6325 data << uint32(pInfo->overDamage); // overkill?
6326 data << uint32(aura->GetSpellInfo()->GetSchoolMask());
6327 data << uint32(absorb); // absorb
6328 data << uint32(pInfo->resist); // resist
6329 data << uint8(pInfo->critical); // new 3.1.2 critical tick
6330 }
6331 break;
6334 data << uint32(pInfo->damage); // damage
6335 data << uint32(pInfo->overDamage); // overheal
6336 data << uint32(pInfo->absorb); // absorb
6337 data << uint8(pInfo->critical); // new 3.1.2 critical tick
6338 break;
6341 data << uint32(aura->GetMiscValue()); // power type
6342 data << uint32(pInfo->damage); // damage
6343 break;
6345 data << uint32(aura->GetMiscValue()); // power type
6346 data << uint32(pInfo->damage); // amount
6347 data << float(pInfo->multiplier); // gain multiplier
6348 break;
6349 default:
6350 LOG_ERROR("entities.unit", "Unit::SendPeriodicAuraLog: unknown aura {}", uint32(aura->GetAuraType()));
6351 return;
6352 }
6353
6354 SendMessageToSet(&data, true);
6355}
@ SPELL_AURA_OBS_MOD_HEALTH
Definition: SpellAuraDefines.h:83
@ SPELL_AURA_PERIODIC_MANA_LEECH
Definition: SpellAuraDefines.h:127
@ SPELL_AURA_PERIODIC_ENERGIZE
Definition: SpellAuraDefines.h:87
@ SMSG_PERIODICAURALOG
Definition: Opcodes.h:620
float multiplier
Definition: Unit.h:940
bool critical
Definition: Unit.h:941
uint32 overDamage
Definition: Unit.h:937
uint32 resist
Definition: Unit.h:939
uint32 damage
Definition: Unit.h:936
AuraEffect const * auraEff
Definition: Unit.h:935
uint32 absorb
Definition: Unit.h:938

References SpellPeriodicAuraLogInfo::absorb, SpellPeriodicAuraLogInfo::auraEff, CHEAT_GOD, SpellPeriodicAuraLogInfo::critical, SpellPeriodicAuraLogInfo::damage, AuraEffect::GetAuraType(), AuraEffect::GetCasterGUID(), AuraEffect::GetId(), AuraEffect::GetMiscValue(), Object::GetPackGUID(), SpellInfo::GetSchoolMask(), AuraEffect::GetSpellInfo(), Object::GetTypeId(), LOG_ERROR, SpellPeriodicAuraLogInfo::multiplier, SpellPeriodicAuraLogInfo::overDamage, SpellPeriodicAuraLogInfo::resist, WorldObject::SendMessageToSet(), SMSG_PERIODICAURALOG, SPELL_AURA_OBS_MOD_HEALTH, SPELL_AURA_OBS_MOD_POWER, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE_PERCENT, SPELL_AURA_PERIODIC_ENERGIZE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_MANA_LEECH, Object::ToPlayer(), TYPEID_PLAYER, and ObjectGuid::WriteAsPacked().

Referenced by AuraEffect::HandleObsModPowerAuraTick(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), and AuraEffect::HandlePeriodicManaLeechAuraTick().

◆ SendPetActionFeedback()

void Unit::SendPetActionFeedback ( uint8  msg)

-------—Pet responses methods--------------—

16757{
16758 Unit* owner = GetOwner();
16759 if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
16760 return;
16761
16763 data << uint8(msg);
16764 owner->ToPlayer()->GetSession()->SendPacket(&data);
16765}
@ SMSG_PET_ACTION_FEEDBACK
Definition: Opcodes.h:740

References GetOwner(), Player::GetSession(), Object::GetTypeId(), WorldSession::SendPacket(), SMSG_PET_ACTION_FEEDBACK, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by WorldSession::HandlePetCancelAuraOpcode().

◆ SendPetAIReaction()

void Unit::SendPetAIReaction ( ObjectGuid  guid)
16780{
16781 Unit* owner = GetOwner();
16782 if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
16783 return;
16784
16785 WorldPacket data(SMSG_AI_REACTION, 8 + 4);
16786 data << guid;
16787 data << uint32(AI_REACTION_HOSTILE);
16788 owner->ToPlayer()->GetSession()->SendPacket(&data);
16789}
@ SMSG_AI_REACTION
Definition: Opcodes.h:346

References AI_REACTION_HOSTILE, GetOwner(), Player::GetSession(), Object::GetTypeId(), WorldSession::SendPacket(), SMSG_AI_REACTION, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by PetAI::DoAttack(), and WorldSession::HandlePetActionHelper().

◆ SendPetTalk()

void Unit::SendPetTalk ( uint32  pettalk)
16768{
16769 Unit* owner = GetOwner();
16770 if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
16771 return;
16772
16774 data << GetGUID();
16775 data << uint32(pettalk);
16776 owner->ToPlayer()->GetSession()->SendPacket(&data);
16777}
@ SMSG_PET_ACTION_SOUND
Definition: Opcodes.h:834

References Object::GetGUID(), GetOwner(), Player::GetSession(), Object::GetTypeId(), WorldSession::SendPacket(), SMSG_PET_ACTION_SOUND, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by WorldSession::HandlePetActionHelper().

◆ SendPlaySpellImpact()

void Unit::SendPlaySpellImpact ( ObjectGuid  guid,
uint32  id 
)
19058{
19060 data << guid; // target
19061 data << uint32(id); // SpellVisualKit.dbc index
19062 SendMessageToSet(&data, true);
19063}
@ SMSG_PLAY_SPELL_IMPACT
Definition: Opcodes.h:533

References WorldObject::SendMessageToSet(), and SMSG_PLAY_SPELL_IMPACT.

Referenced by debug_commandscript::HandleDebugVisualCommand(), and WorldSession::HandleTrainerBuySpellOpcode().

◆ SendPlaySpellVisual()

void Unit::SendPlaySpellVisual ( uint32  id)
19050{
19052 data << GetGUID();
19053 data << uint32(id); // SpellVisualKit.dbc index
19054 SendMessageToSet(&data, true);
19055}
@ SMSG_PLAY_SPELL_VISUAL
Definition: Opcodes.h:529

References Object::GetGUID(), WorldObject::SendMessageToSet(), and SMSG_PLAY_SPELL_VISUAL.

Referenced by debug_commandscript::HandleDebugVisualCommand(), WorldSession::HandleTrainerBuySpellOpcode(), and Player::RegenerateAll().

◆ SendRemoveFromThreatListOpcode()

void Unit::SendRemoveFromThreatListOpcode ( HostileReference pHostileReference)
20255{
20256 LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_REMOVE Message");
20257 WorldPacket data(SMSG_THREAT_REMOVE, 8 + 8);
20258 data << GetPackGUID();
20259 data << pHostileReference->getUnitGuid().WriteAsPacked();
20260 SendMessageToSet(&data, false);
20261}
@ SMSG_THREAT_REMOVE
Definition: Opcodes.h:1186

References Object::GetPackGUID(), HostileReference::getUnitGuid(), LOG_DEBUG, WorldObject::SendMessageToSet(), SMSG_THREAT_REMOVE, and ObjectGuid::WriteAsPacked().

Referenced by ThreatMgr::processThreatEvent().

◆ SendSpellDamageImmune()

void Unit::SendSpellDamageImmune ( Unit target,
uint32  spellId 
)
6382{
6383 WorldPacket data(SMSG_SPELLORDAMAGE_IMMUNE, 8 + 8 + 4 + 1);
6384 data << GetGUID();
6385 data << target->GetGUID();
6386 data << uint32(spellId);
6387 data << uint8(0); // bool - log format: 0-default, 1-debug
6388 SendMessageToSet(&data, true);
6389}
@ SMSG_SPELLORDAMAGE_IMMUNE
Definition: Opcodes.h:641

References Object::GetGUID(), WorldObject::SendMessageToSet(), and SMSG_SPELLORDAMAGE_IMMUNE.

Referenced by DealMeleeDamage(), and AuraEffect::SendTickImmune().

◆ SendSpellDamageResist()

void Unit::SendSpellDamageResist ( Unit target,
uint32  spellId 
)
6372{
6373 WorldPacket data(SMSG_PROCRESIST, 8 + 8 + 4 + 1);
6374 data << GetGUID();
6375 data << target->GetGUID();
6376 data << uint32(spellId);
6377 data << uint8(0); // bool - log format: 0-default, 1-debug
6378 SendMessageToSet(&data, true);
6379}
@ SMSG_PROCRESIST
Definition: Opcodes.h:638

References Object::GetGUID(), WorldObject::SendMessageToSet(), and SMSG_PROCRESIST.

◆ SendSpellMiss()

void Unit::SendSpellMiss ( Unit target,
uint32  spellID,
SpellMissInfo  missInfo 
)
6358{
6359 WorldPacket data(SMSG_SPELLLOGMISS, (4 + 8 + 1 + 4 + 8 + 1));
6360 data << uint32(spellID);
6361 data << GetGUID();
6362 data << uint8(0); // can be 0 or 1
6363 data << uint32(1); // target count
6364 // for (i = 0; i < target count; ++i)
6365 data << target->GetGUID(); // target GUID
6366 data << uint8(missInfo);
6367 // end loop
6368 SendMessageToSet(&data, true);
6369}
@ SMSG_SPELLLOGMISS
Definition: Opcodes.h:617

References Object::GetGUID(), WorldObject::SendMessageToSet(), and SMSG_SPELLLOGMISS.

Referenced by DealMeleeDamage(), and Spell::DoAllEffectOnTarget().

◆ SendSpellNonMeleeDamageLog() [1/2]

void Unit::SendSpellNonMeleeDamageLog ( SpellNonMeleeDamage log)
6223{
6224 WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16 + 4 + 4 + 4 + 1 + 4 + 4 + 1 + 1 + 4 + 4 + 1)); // we guess size
6225 //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop
6226 uint32 damage = log->damage;
6227 uint32 absorb = log->absorb;
6229 {
6230 absorb = damage;
6231 damage = 0;
6232 }
6233 data << log->target->GetPackGUID();
6234 data << log->attacker->GetPackGUID();
6235 data << uint32(log->spellInfo->Id);
6236 data << uint32(damage); // damage amount
6237 int32 overkill = damage - log->target->GetHealth();
6238 data << uint32(overkill > 0 ? overkill : 0); // overkill
6239 data << uint8 (log->schoolMask); // damage school
6240 data << uint32(absorb); // AbsorbedDamage
6241 data << uint32(log->resist); // resist
6242 data << uint8 (log->physicalLog); // if 1, then client show spell name (example: %s's ranged shot hit %s for %u school or %s suffers %u school damage from %s's spell_name
6243 data << uint8 (log->unused); // unused
6244 data << uint32(log->blocked); // blocked
6245 data << uint32(log->HitInfo);
6246 data << uint32(log->HitInfo);
6248 //if (log->HitInfo & SPELL_HIT_TYPE_CRIT_DEBUG)
6249 //{
6250 // data << float(log->CritRoll);
6251 // data << float(log->CritNeeded);
6252 //}
6253 //if (log->HitInfo & SPELL_HIT_TYPE_HIT_DEBUG)
6254 //{
6255 // data << float(log->HitRoll);
6256 // data << float(log->HitNeeded);
6257 //}
6258 //if (log->HitInfo & SPELL_HIT_TYPE_ATTACK_TABLE_DEBUG)
6259 //{
6260 // data << float(log->MissChance);
6261 // data << float(log->DodgeChance);
6262 // data << float(log->ParryChance);
6263 // data << float(log->BlockChance);
6264 // data << float(log->GlanceChance);
6265 // data << float(log->CrushChance);
6266 //}
6267 SendMessageToSet(&data, true);
6268}
@ SPELL_HIT_TYPE_HIT_DEBUG
Definition: SharedDefines.h:1509
@ SPELL_HIT_TYPE_ATTACK_TABLE_DEBUG
Definition: SharedDefines.h:1512
@ SPELL_HIT_TYPE_CRIT_DEBUG
Definition: SharedDefines.h:1507
@ SMSG_SPELLNONMELEEDAMAGELOG
Definition: Opcodes.h:622
bool physicalLog
Definition: Unit.h:922
bool unused
Definition: Unit.h:923

References SpellNonMeleeDamage::absorb, SpellNonMeleeDamage::attacker, SpellNonMeleeDamage::blocked, CHEAT_GOD, SpellNonMeleeDamage::damage, Player::GetCommandStatus(), GetHealth(), Object::GetPackGUID(), Object::GetTypeId(), SpellNonMeleeDamage::HitInfo, SpellInfo::Id, SpellNonMeleeDamage::physicalLog, SpellNonMeleeDamage::resist, SpellNonMeleeDamage::schoolMask, WorldObject::SendMessageToSet(), SMSG_SPELLNONMELEEDAMAGELOG, SPELL_HIT_TYPE_ATTACK_TABLE_DEBUG, SPELL_HIT_TYPE_CRIT_DEBUG, SPELL_HIT_TYPE_HIT_DEBUG, SpellNonMeleeDamage::spellInfo, SpellNonMeleeDamage::target, Object::ToPlayer(), TYPEID_PLAYER, and SpellNonMeleeDamage::unused.

Referenced by CalcAbsorbResist(), DealDamage(), Spell::DoAllEffectOnTarget(), Spell::EffectEnvironmentalDMG(), spell_sindragosa_s_fury::spell_sindragosa_s_fury_SpellScript::HandleDummy(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), AuraEffect::HandleProcTriggerDamageAuraProc(), and SendSpellNonMeleeDamageLog().

◆ SendSpellNonMeleeDamageLog() [2/2]

void Unit::SendSpellNonMeleeDamageLog ( Unit target,
SpellInfo const *  spellInfo,
uint32  Damage,
SpellSchoolMask  damageSchoolMask,
uint32  AbsorbedDamage,
uint32  Resist,
bool  PhysicalDamage,
uint32  Blocked,
bool  CriticalHit = false,
bool  Split = false 
)
6271{
6272 SpellNonMeleeDamage log(this, target, spellInfo, damageSchoolMask);
6273 log.damage = Damage;
6274 log.absorb = AbsorbedDamage;
6275 log.resist = Resist;
6276 log.physicalLog = PhysicalDamage;
6277 log.blocked = Blocked;
6278 log.HitInfo = 0;
6279 if (CriticalHit)
6280 {
6281 log.HitInfo |= SPELL_HIT_TYPE_CRIT;
6282 }
6283 if (Split)
6284 {
6285 log.HitInfo |= SPELL_HIT_TYPE_SPLIT;
6286 }
6288}
@ SPELL_HIT_TYPE_SPLIT
Definition: SharedDefines.h:1510
Definition: Unit.h:908

References SpellNonMeleeDamage::absorb, SpellNonMeleeDamage::blocked, SpellNonMeleeDamage::damage, SpellNonMeleeDamage::HitInfo, SpellNonMeleeDamage::physicalLog, SpellNonMeleeDamage::resist, SendSpellNonMeleeDamageLog(), SPELL_HIT_TYPE_CRIT, and SPELL_HIT_TYPE_SPLIT.

◆ SendSpellNonMeleeReflectLog()

void Unit::SendSpellNonMeleeReflectLog ( SpellNonMeleeDamage log,
Unit attacker 
)
6191{
6192 // Xinef: function for players only, placed in unit because of cosmetics
6193 if (GetTypeId() != TYPEID_PLAYER)
6194 return;
6195
6196 WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16 + 4 + 4 + 4 + 1 + 4 + 4 + 1 + 1 + 4 + 4 + 1)); // we guess size
6197 //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop
6198 uint32 damage = log->damage;
6199 uint32 absorb = log->absorb;
6201 {
6202 absorb = damage;
6203 damage = 0;
6204 }
6205 data << log->target->GetPackGUID();
6206 data << attacker->GetPackGUID();
6207 data << uint32(log->spellInfo->Id);
6208 data << uint32(damage); // damage amount
6209 int32 overkill = damage - log->target->GetHealth();
6210 data << uint32(overkill > 0 ? overkill : 0); // overkill
6211 data << uint8 (log->schoolMask); // damage school
6212 data << uint32(absorb); // AbsorbedDamage
6213 data << uint32(log->resist); // resist
6214 data << uint8 (log->physicalLog); // if 1, then client show spell name (example: %s's ranged shot hit %s for %u school or %s suffers %u school damage from %s's spell_name
6215 data << uint8 (log->unused); // unused
6216 data << uint32(log->blocked); // blocked
6217 data << uint32(log->HitInfo);
6218 data << uint8 (0); // flag to use extend data
6219 ToPlayer()->SendDirectMessage(&data);
6220}

References SpellNonMeleeDamage::absorb, SpellNonMeleeDamage::blocked, CHEAT_GOD, SpellNonMeleeDamage::damage, Player::GetCommandStatus(), GetHealth(), Object::GetPackGUID(), Object::GetTypeId(), SpellNonMeleeDamage::HitInfo, SpellInfo::Id, SpellNonMeleeDamage::physicalLog, SpellNonMeleeDamage::resist, SpellNonMeleeDamage::schoolMask, Player::SendDirectMessage(), SMSG_SPELLNONMELEEDAMAGELOG, SpellNonMeleeDamage::spellInfo, SpellNonMeleeDamage::target, Object::ToPlayer(), TYPEID_PLAYER, and SpellNonMeleeDamage::unused.

Referenced by Spell::DoAllEffectOnTarget().

◆ SendTameFailure()

void Unit::SendTameFailure ( uint8  result)
20127{
20129 data << uint8(result);
20130 ToPlayer()->SendDirectMessage(&data);
20131}
@ SMSG_PET_TAME_FAILURE
Definition: Opcodes.h:401

References Player::SendDirectMessage(), SMSG_PET_TAME_FAILURE, and Object::ToPlayer().

Referenced by spell_hun_tame_beast::CheckCast(), and Spell::CheckCast().

◆ SendTeleportPacket()

void Unit::SendTeleportPacket ( Position pos)
20134{
20136 if (GetTypeId() == TYPEID_UNIT)
20137 Relocate(&pos);
20138 if (GetTypeId() == TYPEID_PLAYER)
20139 {
20140 ToPlayer()->SetCanTeleport(true);
20141 }
20142 WorldPacket data2(MSG_MOVE_TELEPORT, 38);
20143 data2 << GetPackGUID();
20144 BuildMovementPacket(&data2);
20145 if (GetTypeId() == TYPEID_UNIT)
20146 Relocate(&oldPos);
20147 if (GetTypeId() == TYPEID_PLAYER)
20148 Relocate(&pos);
20149 SendMessageToSet(&data2, false);
20150}
@ MSG_MOVE_TELEPORT
Definition: Opcodes.h:227
void SetCanTeleport(bool value)
Definition: Player.h:2448

References BuildMovementPacket(), Position::GetOrientation(), Object::GetPackGUID(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Object::GetTypeId(), MSG_MOVE_TELEPORT, Position::Relocate(), WorldObject::SendMessageToSet(), Player::SetCanTeleport(), Object::ToPlayer(), TYPEID_PLAYER, and TYPEID_UNIT.

Referenced by NearTeleportTo(), and Player::TeleportTo().

◆ SendThreatListUpdate()

void Unit::SendThreatListUpdate ( )
20206{
20207 if (!GetThreatMgr().isThreatListEmpty())
20208 {
20209 uint32 count = GetThreatMgr().GetThreatList().size();
20210
20211 //LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_UPDATE Message");
20212 WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8);
20213 data << GetPackGUID();
20214 data << uint32(count);
20216 for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
20217 {
20218 data << (*itr)->getUnitGuid().WriteAsPacked();
20219 data << uint32((*itr)->GetThreat() * 100);
20220 }
20221 SendMessageToSet(&data, false);
20222 }
20223}
@ SMSG_THREAT_UPDATE
Definition: Opcodes.h:1185

References Object::GetPackGUID(), ThreatMgr::GetThreatList(), GetThreatMgr(), WorldObject::SendMessageToSet(), and SMSG_THREAT_UPDATE.

Referenced by Update().

◆ SetAI()

void Unit::SetAI ( UnitAI newAI)
inline
1317{ i_AI = newAI; }

References i_AI.

◆ SetArmor()

void Unit::SetArmor ( int32  val)
inline

◆ SetAttackTime()

◆ setAttackTimer()

◆ SetAuraStack()

void Unit::SetAuraStack ( uint32  spellId,
Unit target,
uint32  stack 
)
19041{
19042 Aura* aura = target->GetAura(spellId, GetGUID());
19043 if (!aura)
19044 aura = AddAura(spellId, target);
19045 if (aura && stack)
19046 aura->SetStackAmount(stack);
19047}
void SetStackAmount(uint8 num)
Definition: SpellAuras.cpp:1009

References AddAura(), GetAura(), Object::GetGUID(), and Aura::SetStackAmount().

Referenced by boss_viscidus::DamageTaken(), spell_capacitus_polarity_charge::spell_capacitus_polarity_charge_SpellScript::HandleTargets(), spell_thaddius_pos_neg_charge::spell_thaddius_pos_neg_charge_SpellScript::HandleTargets(), and BattlefieldWG::OnPlayerJoinWar().

◆ SetBaseWeaponDamage()

void Unit::SetBaseWeaponDamage ( WeaponAttackType  attType,
WeaponDamageRange  damageRange,
float  value,
uint8  damageIndex = 0 
)
inline
2118{ m_weaponDamage[attType][damageRange][damageIndex] = value; }

References m_weaponDamage.

Referenced by Player::_ApplyWeaponDamage(), Guardian::InitStatsForLevel(), and Creature::SelectLevel().

◆ SetCanDualWield()

virtual void Unit::SetCanDualWield ( bool  value)
inlinevirtual

◆ SetCanFly()

◆ SetCanModifyStats()

◆ SetCantProc()

void Unit::SetCantProc ( bool  apply)
inline
2322 {
2323 if (apply)
2324 ++m_procDeep;
2325 else
2326 {
2328 --m_procDeep;
2329 }
2330 }

References ASSERT, and m_procDeep.

Referenced by HandleDummyAuraProc(), and ProcDamageAndSpellFor().

◆ SetCharm()

void Unit::SetCharm ( Unit target,
bool  apply 
)
10837{
10838 if (apply)
10839 {
10840 if (GetTypeId() == TYPEID_PLAYER)
10841 {
10842 if (!AddGuidValue(UNIT_FIELD_CHARM, charm->GetGUID()))
10843 LOG_FATAL("entities.unit", "Player {} is trying to charm unit {}, but it already has a charmed unit {}", GetName(), charm->GetEntry(), GetCharmGUID().ToString());
10844
10845 charm->m_ControlledByPlayer = true;
10846 // TODO: maybe we can use this flag to check if controlled by player
10847 charm->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
10848 }
10849 else
10850 charm->m_ControlledByPlayer = false;
10851
10852 // PvP, FFAPvP
10853 charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, GetByteValue(UNIT_FIELD_BYTES_2, 1));
10854
10855 if (!charm->AddGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID()))
10856 LOG_FATAL("entities.unit", "Unit {} is being charmed, but it already has a charmer {}", charm->GetEntry(), charm->GetCharmerGUID().ToString());
10857
10858 _isWalkingBeforeCharm = charm->IsWalking();
10860 {
10861 charm->SetWalk(false);
10862 charm->SendMovementFlagUpdate();
10863 }
10864
10865 m_Controlled.insert(charm);
10866 }
10867 else
10868 {
10869 if (GetTypeId() == TYPEID_PLAYER)
10870 {
10871 if (!RemoveGuidValue(UNIT_FIELD_CHARM, charm->GetGUID()))
10872 LOG_FATAL("entities.unit", "Player {} is trying to uncharm unit {}, but it has another charmed unit {}", GetName(), charm->GetEntry(), GetCharmGUID().ToString());
10873 }
10874
10875 if (!charm->RemoveGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID()))
10876 LOG_FATAL("entities.unit", "Unit {} is being uncharmed, but it has another charmer {}", charm->GetEntry(), charm->GetCharmerGUID().ToString());
10877
10878 if (charm->GetTypeId() == TYPEID_PLAYER)
10879 {
10880 charm->m_ControlledByPlayer = true;
10881 charm->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
10882 charm->ToPlayer()->UpdatePvPState();
10883 }
10884 else if (Player* player = charm->GetCharmerOrOwnerPlayerOrPlayerItself())
10885 {
10886 charm->m_ControlledByPlayer = true;
10887 charm->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
10888 charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, player->GetByteValue(UNIT_FIELD_BYTES_2, 1));
10889
10890 // Xinef: skip controlled erase if charmed unit is owned by charmer
10891 if (charm->IsInWorld() && !charm->IsDuringRemoveFromWorld() && player->GetGUID() == this->GetGUID() && (charm->IsPet() || charm->HasUnitTypeMask(UNIT_MASK_MINION)))
10892 return;
10893 }
10894 else
10895 {
10896 charm->m_ControlledByPlayer = false;
10897 charm->RemoveUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
10898 charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, 0);
10899 }
10900
10901 if (charm->IsWalking() != _isWalkingBeforeCharm)
10902 {
10903 charm->SetWalk(_isWalkingBeforeCharm);
10904 charm->SendMovementFlagUpdate(true); // send packet to self, to update movement state on player.
10905 }
10906
10907 m_Controlled.erase(charm);
10908 }
10909}
bool AddGuidValue(uint16 index, ObjectGuid value)
Definition: Object.cpp:686
bool RemoveGuidValue(uint16 index, ObjectGuid value)
Definition: Object.cpp:704

References _isWalkingBeforeCharm, Object::AddGuidValue(), Object::GetByteValue(), GetCharmerGUID(), GetCharmerOrOwnerPlayerOrPlayerItself(), GetCharmGUID(), Object::GetEntry(), Object::GetGUID(), WorldObject::GetName(), Object::GetTypeId(), HasUnitTypeMask(), IsDuringRemoveFromWorld(), Object::IsInWorld(), IsPet(), IsWalking(), LOG_FATAL, m_Controlled, m_ControlledByPlayer, Object::RemoveGuidValue(), RemoveUnitFlag(), SendMovementFlagUpdate(), Object::SetByteValue(), SetUnitFlag(), SetWalk(), Object::ToPlayer(), ObjectGuid::ToString(), Position::ToString(), TYPEID_PLAYER, UNIT_FIELD_BYTES_2, UNIT_FIELD_CHARM, UNIT_FIELD_CHARMEDBY, UNIT_FLAG_PLAYER_CONTROLLED, UNIT_MASK_MINION, and Player::UpdatePvPState().

Referenced by RemoveCharmedBy(), SetCharmedBy(), and Player::StopCastingCharm().

◆ SetCharmedBy()

bool Unit::SetCharmedBy ( Unit charmer,
CharmType  type,
AuraApplication const *  aurApp = nullptr 
)
18492{
18493 if (!charmer)
18494 return false;
18495
18496 if (!charmer->IsInWorld() || charmer->IsDuringRemoveFromWorld())
18497 {
18498 return false;
18499 }
18500
18501 // dismount players when charmed
18502 if (GetTypeId() == TYPEID_PLAYER)
18504
18505 if (charmer->GetTypeId() == TYPEID_PLAYER)
18507
18508 ASSERT(type != CHARM_TYPE_POSSESS || charmer->GetTypeId() == TYPEID_PLAYER);
18509 if (type == CHARM_TYPE_VEHICLE && !IsVehicle()) // pussywizard
18510 throw 1;
18511 ASSERT((type == CHARM_TYPE_VEHICLE) == IsVehicle());
18512
18513 LOG_DEBUG("entities.unit", "SetCharmedBy: charmer {} ({}), charmed {} ({}), type {}.",
18514 charmer->GetEntry(), charmer->GetGUID().ToString(), GetEntry(), GetGUID().ToString(), uint32(type));
18515
18516 if (this == charmer)
18517 {
18518 LOG_FATAL("entities.unit", "Unit::SetCharmedBy: Unit {} ({}) is trying to charm itself!", GetEntry(), GetGUID().ToString());
18519 return false;
18520 }
18521
18522 //if (HasUnitState(UNIT_STATE_UNATTACKABLE))
18523 // return false;
18524
18526 {
18527 LOG_FATAL("entities.unit", "Unit::SetCharmedBy: Player on transport is trying to charm {} ({})", GetEntry(), GetGUID().ToString());
18528 return false;
18529 }
18530
18531 // Already charmed
18532 if (GetCharmerGUID())
18533 {
18534 LOG_FATAL("entities.unit", "Unit::SetCharmedBy: {} ({}) has already been charmed but {} ({}) is trying to charm it!",
18535 GetEntry(), GetGUID().ToString(), charmer->GetEntry(), charmer->GetGUID().ToString());
18536 return false;
18537 }
18538
18539 CastStop();
18540 AttackStop();
18541
18542 // Xinef: dont reset threat and combat, put them on offline list, moved down after faction changes
18543 // CombatStop(); // TODO: CombatStop(true) may cause crash (interrupt spells)
18544 // DeleteThreatList();
18545
18546 Player* playerCharmer = charmer->ToPlayer();
18547
18548 // Charmer stop charming
18549 if (playerCharmer)
18550 {
18551 playerCharmer->StopCastingCharm();
18552 playerCharmer->StopCastingBindSight();
18553 }
18554
18555 // Charmed stop charming
18556 if (GetTypeId() == TYPEID_PLAYER)
18557 {
18560 }
18561
18562 // StopCastingCharm may remove a possessed pet?
18563 if (!IsInWorld())
18564 {
18565 LOG_FATAL("entities.unit", "Unit::SetCharmedBy: {} ({}) is not in world but {} ({}) is trying to charm it!",
18566 GetEntry(), GetGUID().ToString(), charmer->GetEntry(), charmer->GetGUID().ToString());
18567 return false;
18568 }
18569
18570 // charm is set by aura, and aura effect remove handler was called during apply handler execution
18571 // prevent undefined behaviour
18572 if (aurApp && aurApp->GetRemoveMode())
18573 return false;
18574
18576 SetFaction(charmer->GetFaction());
18577
18578 // Set charmed
18579 charmer->SetCharm(this, true);
18580
18582
18583 if (GetTypeId() == TYPEID_UNIT)
18584 {
18585 GetMotionMaster()->Clear(false);
18587 StopMoving();
18588
18589 if (charmer->GetTypeId() == TYPEID_PLAYER && charmer->getClass() == CLASS_WARLOCK && ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_DEMON)
18590 {
18591 // Disable CreatureAI/SmartAI and switch to CharmAI when charmed by warlock
18592 Creature* charmed = ToCreature();
18593 charmed->NeedChangeAI = true;
18594 charmed->IsAIEnabled = false;
18595 }
18596 else
18597 {
18598 ToCreature()->AI()->OnCharmed(true);
18599 }
18600
18601 // Xinef: If creature can fly, add normal player flying flag (fixes speed)
18602 if (charmer->GetTypeId() == TYPEID_PLAYER && ToCreature()->CanFly())
18604 }
18605 else
18606 {
18607 Player* player = ToPlayer();
18608 if (player->isAFK())
18609 player->ToggleAFK();
18610
18611 player->SetClientControl(this, false); // verified
18612 }
18613
18614 // charm is set by aura, and aura effect remove handler was called during apply handler execution
18615 // prevent undefined behaviour
18616 if (aurApp && aurApp->GetRemoveMode())
18617 return false;
18618
18619 // Pets already have a properly initialized CharmInfo, don't overwrite it.
18620 // Xinef: I need charmInfo for vehicle
18621 if (/*type != CHARM_TYPE_VEHICLE &&*/ !GetCharmInfo())
18622 {
18623 InitCharmInfo();
18624 if (type == CHARM_TYPE_POSSESS)
18626 else if (type != CHARM_TYPE_VEHICLE)
18627 {
18629
18630 // Xinef: convert charm npcs dont have pet bar so initialize them as defensive helpers
18631 if (type == CHARM_TYPE_CONVERT && GetTypeId() == TYPEID_UNIT)
18633 }
18634 }
18635
18636 if (playerCharmer)
18637 {
18638 switch (type)
18639 {
18640 case CHARM_TYPE_VEHICLE:
18643 playerCharmer->SetClientControl(this, true); // verified
18644 playerCharmer->VehicleSpellInitialize();
18645 break;
18646 case CHARM_TYPE_POSSESS:
18651 playerCharmer->SetClientControl(this, true); // verified
18652 playerCharmer->PossessSpellInitialize();
18653 break;
18654 case CHARM_TYPE_CHARM:
18655 if (GetTypeId() == TYPEID_UNIT && charmer->getClass() == CLASS_WARLOCK)
18656 {
18658 if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
18659 {
18660 // to prevent client crash
18662
18663 // just to enable stat window
18664 if (GetCharmInfo())
18665 GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
18666
18667 // if charmed two demons the same session, the 2nd gets the 1st one's name
18668 SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(GameTime::GetGameTime().count())); // cast can't be helped
18669 }
18670 }
18672 playerCharmer->CharmSpellInitialize();
18673 break;
18674 default:
18675 break;
18676 }
18677 }
18678 else if (GetTypeId() == TYPEID_PLAYER)
18680
18681 if (Creature* creature = ToCreature())
18682 creature->RefreshSwimmingFlag();
18683
18684 if (GetTypeId() == TYPEID_PLAYER)
18685 sScriptMgr->OnPlayerBeingCharmed(ToPlayer(), charmer, _oldFactionId, charmer->GetFaction());
18686
18687 return true;
18688}
@ UNIT_FIELD_PET_NAME_TIMESTAMP
Definition: UpdateFields.h:133
@ REACT_DEFENSIVE
Definition: Unit.h:1024
@ CHARM_TYPE_CONVERT
Definition: Unit.h:1078
void OnCharmed(bool apply) override
Definition: CreatureAI.cpp:33
void SetReactState(ReactStates st)
Definition: Creature.h:89
void CharmSpellInitialize()
Definition: Player.cpp:9522
void ToggleAFK()
Definition: Player.cpp:1272
void PossessSpellInitialize()
Definition: Player.cpp:9419
void StopCastingBindSight()
Definition: Player.cpp:13045
bool isAFK() const
Definition: Player.h:1114
void VehicleSpellInitialize()
Definition: Player.cpp:9447
void InitPossessCreateSpells()
Definition: Unit.cpp:15767
void InitCharmCreateSpells()
Definition: Unit.cpp:15803
virtual float GetFollowAngle() const
Definition: Unit.h:2392
CharmInfo * InitCharmInfo()
Definition: Unit.cpp:15699
void MoveIdle()
Definition: MotionMaster.cpp:231

References _oldFactionId, AddUnitMovementFlag(), AddUnitState(), Creature::AI(), ASSERT, AttackStop(), CanFly(), CastStop(), CHARM_TYPE_CHARM, CHARM_TYPE_CONVERT, CHARM_TYPE_POSSESS, CHARM_TYPE_VEHICLE, Player::CharmSpellInitialize(), CLASS_MAGE, CLASS_WARLOCK, MotionMaster::Clear(), CREATURE_TYPE_DEMON, GetCharmerGUID(), GetCharmInfo(), getClass(), Creature::GetCreatureTemplate(), Object::GetEntry(), GetFaction(), GetFollowAngle(), GameTime::GetGameTime(), Object::GetGUID(), GetMotionMaster(), AuraApplication::GetRemoveMode(), WorldObject::GetTransport(), Object::GetTypeId(), CharmInfo::InitCharmCreateSpells(), InitCharmInfo(), CharmInfo::InitPossessCreateSpells(), Player::isAFK(), IsAIEnabled, IsDuringRemoveFromWorld(), Object::IsInWorld(), IsVehicle(), LOG_DEBUG, LOG_FATAL, MotionMaster::MoveFollow(), MotionMaster::MoveIdle(), MOVEMENTFLAG_FLYING, NeedChangeAI, CreatureAI::OnCharmed(), PET_FOLLOW_DIST, Player::PossessSpellInitialize(), REACT_DEFENSIVE, RemoveAurasByType(), Object::SetByteValue(), SetCharm(), Player::SetClientControl(), SetFaction(), CharmInfo::SetPetNumber(), Creature::SetReactState(), Object::SetUInt32Value(), SetUnitFlag(), sObjectMgr, SPELL_AURA_MOD_SHAPESHIFT, SPELL_AURA_MOUNTED, sScriptMgr, StopAttackingInvalidTarget(), Player::StopCastingBindSight(), Player::StopCastingCharm(), StopMoving(), Object::ToCreature(), Player::ToggleAFK(), Object::ToPlayer(), ObjectGuid::ToString(), Position::ToString(), CreatureTemplate::type, TYPEID_PLAYER, TYPEID_UNIT, UNIT_FIELD_BYTES_0, UNIT_FIELD_PET_NAME_TIMESTAMP, UNIT_FLAG_DISABLE_MOVE, UNIT_FLAG_POSSESSED, UNIT_STATE_NO_ENVIRONMENT_UPD, UNIT_STATE_POSSESSED, and Player::VehicleSpellInitialize().

Referenced by Vehicle::AddPassenger(), AuraEffect::HandleCharmConvert(), AuraEffect::HandleModCharm(), AuraEffect::HandleModPossess(), AuraEffect::HandleModPossessPet(), and Puppet::InitSummon().

◆ SetCharmerGUID()

void Unit::SetCharmerGUID ( ObjectGuid  owner)
inline

◆ SetCombatTimer()

void Unit::SetCombatTimer ( uint32  timer)
inline
1699{ m_CombatTimer = timer; }

References m_CombatTimer.

◆ SetConfused()

void Unit::SetConfused ( bool  apply)
protected
18455{
18456 if (apply)
18457 {
18458 SetTarget();
18460
18461 if (GetTypeId() == TYPEID_PLAYER)
18462 {
18463 sScriptMgr->AnticheatSetSkipOnePacketForASH(ToPlayer(), true);
18464 }
18465 }
18466 else
18467 {
18468 if (IsAlive())
18469 {
18470 if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == CONFUSED_MOTION_TYPE)
18471 {
18473 StopMoving();
18474 }
18475
18476 if (GetVictim())
18478 }
18479 }
18480
18481 // xinef: block / allow control to real mover (eg. charmer)
18482 if (GetTypeId() == TYPEID_PLAYER)
18483 {
18484 if (m_movedByPlayer)
18485 m_movedByPlayer->ToPlayer()->SetClientControl(this, !apply); // verified
18486 //else
18487 // ToPlayer()->SetClientControl(this, !apply);
18488 }
18489}
@ CONFUSED_MOTION_TYPE
Definition: MotionMaster.h:42
void MoveConfused()
Definition: MotionMaster.cpp:281

References CONFUSED_MOTION_TYPE, Object::GetGUID(), GetMotionMaster(), Object::GetTypeId(), GetVictim(), IsAlive(), m_movedByPlayer, MOTION_SLOT_CONTROLLED, MotionMaster::MoveConfused(), MotionMaster::MovementExpired(), Player::SetClientControl(), SetTarget(), sScriptMgr, StopMoving(), Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by SetControlled().

◆ SetContestedPvP()

void Unit::SetContestedPvP ( Player attackedPlayer = nullptr,
bool  lookForNearContestedGuards = true 
)
17394{
17396
17397 if (!player || ((attackedPlayer && (attackedPlayer == player || (player->duel && player->duel->Opponent == attackedPlayer))) || player->InBattleground()))
17398 return;
17399
17400 // check if there any guards that should care about the contested flag on player
17401 if (lookForNearContestedGuards)
17402 {
17403 std::list<Unit*> targets;
17406 Cell::VisitAllObjects(this, searcher, MAX_AGGRO_RADIUS);
17407
17408 // return if there are no contested guards found
17409 if (!targets.size())
17410 {
17411 return;
17412 }
17413 }
17414
17415 player->SetContestedPvPTimer(30000);
17417 {
17420 // call MoveInLineOfSight for nearby contested guards
17422 }
17424 {
17426 // call MoveInLineOfSight for nearby contested guards
17428 }
17429}
#define MAX_AGGRO_RADIUS
Definition: Unit.h:162
void SetPlayerFlag(PlayerFlags flags)
Definition: Player.h:1091
bool InBattleground() const
Definition: Player.h:2201
void SetContestedPvPTimer(uint32 newTime)
Definition: Player.h:1819

References WorldObject::AddToNotify(), AddUnitState(), Player::duel, GetCharmerOrOwnerPlayerOrPlayerItself(), HasUnitState(), Player::InBattleground(), MAX_AGGRO_RADIUS, NOTIFY_AI_RELOCATION, PLAYER_FLAGS_CONTESTED_PVP, Player::SetContestedPvPTimer(), Player::SetPlayerFlag(), UNIT_STATE_ATTACK_PLAYER, and Cell::VisitAllObjects().

Referenced by CombatStart(), CombatStartOnCast(), Spell::DoSpellHitOnUnit(), and WorldSession::HandlePlayerLoginFromDB().

◆ SetControlled()

void Unit::SetControlled ( bool  apply,
UnitState  state,
Unit source = nullptr,
bool  isFear = false 
)
18166{
18167 if (apply)
18168 {
18169 if (HasUnitState(state))
18170 return;
18171
18172 AddUnitState(state);
18173 switch (state)
18174 {
18175 case UNIT_STATE_STUNNED:
18176 SetStunned(true);
18177 break;
18178 case UNIT_STATE_ROOT:
18180 SetRooted(true);
18181 break;
18184 {
18187 // SendAutoRepeatCancel ?
18188 SetConfused(true);
18189 CastStop(0, false);
18190 }
18191 break;
18192 case UNIT_STATE_FLEEING:
18194 {
18197 // SendAutoRepeatCancel ?
18198 SetFeared(true, source, isFear);
18199 CastStop(0, false);
18200 }
18201 break;
18202 default:
18203 break;
18204 }
18205
18206 if (GetTypeId() == TYPEID_PLAYER)
18207 {
18208 sScriptMgr->AnticheatSetRootACKUpd(ToPlayer());
18209 }
18210 }
18211 else
18212 {
18213 // xinef: moved from below, checked all SetX functions, no calls to currently modified state
18214 // xinef: added to each case because of return
18215 //ClearUnitState(state);
18216
18217 switch (state)
18218 {
18219 case UNIT_STATE_STUNNED:
18221 return;
18222 ClearUnitState(state);
18223 SetStunned(false);
18224 break;
18225 case UNIT_STATE_ROOT:
18226 // Prevent creature_template_movement rooted flag from being removed on aura expiration.
18227 if (GetTypeId() == TYPEID_UNIT)
18228 {
18229 if (ToCreature()->GetCreatureTemplate()->Movement.Rooted)
18230 {
18231 return;
18232 }
18233 }
18234
18236 return;
18237 ClearUnitState(state);
18238 SetRooted(false);
18239 break;
18242 return;
18243 ClearUnitState(state);
18244 SetConfused(false);
18245 break;
18246 case UNIT_STATE_FLEEING:
18248 return;
18249 ClearUnitState(state);
18250 SetFeared(false);
18251 break;
18252 default:
18253 return;
18254 }
18255
18256 //ClearUnitState(state);
18257
18259 SetStunned(true);
18260 else
18261 {
18263 SetRooted(true);
18264
18266 SetConfused(true);
18268 {
18269 bool isFear = false;
18271 {
18272 isFear = true;
18273 source = ObjectAccessor::GetUnit(*this, GetAuraEffectsByType(SPELL_AURA_MOD_FEAR).front()->GetCasterGUID());
18274 }
18275
18276 if (!source)
18277 {
18278 source = getAttackerForHelper();
18279 }
18280
18281 SetFeared(true, source, isFear);
18282 }
18283 }
18284 }
18285}
Definition: Unit.h:688
void SetFeared(bool apply, Unit *fearedBy=nullptr, bool isFear=false)
Definition: Unit.cpp:18417
void SetConfused(bool apply)
Definition: Unit.cpp:18454
void SetStunned(bool apply)
Definition: Unit.cpp:18287
Unit * getAttackerForHelper() const
Definition: Unit.h:1366
void SetRooted(bool apply, bool isStun=false)
Definition: Unit.cpp:18335

References AddUnitState(), CastStop(), ClearUnitState(), getAttackerForHelper(), GetAuraEffectsByType(), Object::GetTypeId(), ObjectAccessor::GetUnit(), GetVehicle(), HasAuraType(), HasUnitState(), SendMeleeAttackStop(), SetConfused(), SetFeared(), SetRooted(), SetStunned(), SPELL_AURA_MOD_CONFUSE, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, sScriptMgr, Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, UNIT_STATE_CONFUSED, UNIT_STATE_FLEEING, UNIT_STATE_MELEE_ATTACKING, UNIT_STATE_ROOT, and UNIT_STATE_STUNNED.

Referenced by _ExitVehicle(), Vehicle::AddPassenger(), boss_ouro::boss_ouro(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::DamageTaken(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), boss_twinemperorsAI::DoAction(), npc_twilight_volunteer::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), boss_palehoof::boss_palehoofAI::DoAction(), Creature::DoFleeToGetAssistance(), boss_skeram::DoTeleport(), CritterAI::EnterCombat(), boss_skadi::boss_skadiAI::EnterCombat(), CritterAI::EnterEvadeMode(), boss_devourer_of_souls::boss_devourer_of_soulsAI::EnterEvadeMode(), boss_falric::boss_falricAI::EnterEvadeMode(), boss_garfrost::boss_garfrostAI::EnterEvadeMode(), boss_rotface::boss_rotfaceAI::EnterEvadeMode(), boss_sindragosa::boss_sindragosaAI::EnterEvadeMode(), boss_noth::boss_nothAI::EnterEvadeMode(), boss_thaddius_summon::boss_thaddius_summonAI::EnterEvadeMode(), boss_urom::boss_uromAI::EnterEvadeMode(), boss_varos::boss_varosAI::EnterEvadeMode(), boss_ignis::boss_ignisAI::EnterEvadeMode(), boss_razorscale::boss_razorscaleAI::EnterEvadeMode(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::EnterEvadeMode(), boss_svala::boss_svalaAI::EnterEvadeMode(), boss_cyanigosa::boss_cyanigosaAI::EnterEvadeMode(), boss_shirrak_the_dead_watcher::boss_shirrak_the_dead_watcherAI::EnterEvadeMode(), spell_boss_magus_telestra_summon_telestra_clones::spell_boss_magus_telestra_summon_telestra_clones_AuraScript::HandleApply(), AuraEffect::HandleAuraModRoot(), AuraEffect::HandleAuraModStun(), debug_commandscript::HandleDebugMoveflagsCommand(), spell_q13007_iron_colossus::spell_q13007_iron_colossus_SpellScript::HandleDummy(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_mc_play_dead::spell_mc_play_dead_AuraScript::HandleEffectApply(), spell_gen_visual_dummy_stun::HandleEffectApply(), spell_q11396_11399_force_shield_arcane_purple_x3::HandleEffectApply(), spell_mc_play_dead::spell_mc_play_dead_AuraScript::HandleEffectRemove(), spell_gen_visual_dummy_stun::HandleEffectRemove(), AuraEffect::HandleModConfuse(), AuraEffect::HandleModFear(), AuraEffect::HandlePreventFleeing(), spell_boss_magus_telestra_summon_telestra_clones::spell_boss_magus_telestra_summon_telestra_clones_AuraScript::HandleRemove(), boss_volazj::JustDied(), boss_skeram::JustSummoned(), npc_shay_leafrunner::npc_shay_leafrunnerAI::MoveInLineOfSight(), npc_twilight_volunteer::MovementInform(), boss_garfrost::boss_garfrostAI::MovementInform(), boss_volkhan::boss_volkhanAI::MovementInform(), boss_razorscale::boss_razorscaleAI::MovementInform(), npc_gunship_mage::npc_gunship_mageAI::MovementInform(), npc_gunship_gunner::npc_gunship_gunnerAI::MovementInform(), npc_gunship_rocketeer::npc_gunship_rocketeerAI::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), npc_iron_watcher::npc_iron_watcherAI::MovementInform(), npc_buru_egg::npc_buru_egg(), npc_icc_blood_beast::npc_icc_blood_beastAI::npc_icc_blood_beastAI(), npc_raging_spirit::npc_raging_spiritAI::npc_raging_spiritAI(), npc_vengeful_shade::npc_vengeful_shadeAI::npc_vengeful_shadeAI(), spell_systems_shutdown::spell_systems_shutdown_AuraScript::OnApply(), spell_systems_shutdown::spell_systems_shutdown_AuraScript::OnRemove(), boss_ragnaros::boss_ragnarosAI::Reset(), boss_skeram::Reset(), boss_volazj::Reset(), npc_twilight_summon::npc_twilight_summonAI::Reset(), boss_devourer_of_souls::boss_devourer_of_soulsAI::Reset(), boss_falric::boss_falricAI::Reset(), boss_garfrost::boss_garfrostAI::Reset(), boss_sindragosa::boss_sindragosaAI::Reset(), boss_noth::boss_nothAI::Reset(), boss_thaddius::boss_thaddiusAI::Reset(), boss_thaddius_summon::boss_thaddius_summonAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_loken::boss_lokenAI::Reset(), boss_ignis::boss_ignisAI::Reset(), boss_thorim_pillar::boss_thorim_pillarAI::Reset(), boss_xt002::boss_xt002AI::Reset(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::Reset(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::Reset(), boss_palehoof::boss_palehoofAI::Reset(), boss_skadi::boss_skadiAI::Reset(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::Reset(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::Reset(), npc_iron_watcher::npc_iron_watcherAI::Reset(), boss_shirrak_the_dead_watcher::boss_shirrak_the_dead_watcherAI::Reset(), npc_target_dummy::npc_target_dummyAI::Reset(), Player::SetClientControl(), boss_urom::boss_uromAI::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), boss_garfrost::boss_garfrostAI::SpellHitTarget(), npc_vengeful_shade::npc_vengeful_shadeAI::SpellHitTarget(), boss_volkhan::boss_volkhanAI::SpellHitTarget(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), boss_ionar::boss_ionarAI::Split(), boss_noth::boss_nothAI::StartBalconyPhase(), boss_noth::boss_nothAI::StartGroundPhase(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonedCreatureDies(), boss_malchezaar::boss_malchezaarAI::SummonInfernal(), boss_skeram::UpdateAI(), boss_volazj::UpdateAI(), boss_falric::boss_falricAI::UpdateAI(), npc_icc_blood_beast::npc_icc_blood_beastAI::UpdateAI(), npc_vengeful_shade::npc_vengeful_shadeAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), boss_ionar::boss_ionarAI::UpdateAI(), boss_loken::boss_lokenAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), boss_skadi::boss_skadiAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_cyanigosa::boss_cyanigosaAI::UpdateAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::UpdateAI(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::UpdateAI(), boss_shirrak_the_dead_watcher::boss_shirrak_the_dead_watcherAI::UpdateAI(), boss_gruul::boss_gruulAI::UpdateAI(), npc_target_dummy::npc_target_dummyAI::UpdateAI(), Creature::UpdateEntry(), and npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::WaypointReached().

◆ SetCreateHealth()

◆ SetCreateMana()

◆ SetCreateStat()

void Unit::SetCreateStat ( Stats  stat,
float  val 
)
inline

◆ SetCreatorGUID()

◆ SetCritterGUID()

void Unit::SetCritterGUID ( ObjectGuid  guid)
inline

References Object::SetGuidValue(), and UNIT_FIELD_CRITTER.

Referenced by SetMinion().

◆ SetCurrentCastedSpell()

void Unit::SetCurrentCastedSpell ( Spell pSpell)
3910{
3911 ASSERT(pSpell); // nullptr may be never passed here, use InterruptSpell or InterruptNonMeleeSpells
3912
3913 CurrentSpellTypes CSpellType = pSpell->GetCurrentContainer();
3914
3915 if (pSpell == m_currentSpells[CSpellType]) // avoid breaking self
3916 return;
3917
3918 bool bySelf = m_currentSpells[CSpellType] && m_currentSpells[CSpellType]->m_spellInfo->Id == pSpell->m_spellInfo->Id;
3919
3920 // break same type spell if it is not delayed
3921 InterruptSpell(CSpellType, false, true, bySelf);
3922
3923 // special breakage effects:
3924 switch (CSpellType)
3925 {
3927 {
3928 // generic spells always break channeled not delayed spells
3930 {
3931 if (!s->GetSpellInfo()->IsActionAllowedChannel())
3932 {
3934 }
3935 }
3936
3937 // autorepeat breaking
3939 {
3940 // break autorepeat if not Auto Shot
3941 if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75)
3943 m_AutoRepeatFirstCast = true;
3944 }
3945 if (pSpell->GetCastTime() > 0)
3947
3948 break;
3949 }
3951 {
3952 // channel spells always break generic non-delayed and any channeled spells
3954 InterruptSpell(CURRENT_CHANNELED_SPELL, true, true, bySelf);
3955
3956 // it also does break autorepeat if not Auto Shot
3958 m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75)
3961
3962 break;
3963 }
3965 {
3966 // only Auto Shoot does not break anything
3967 if (pSpell->m_spellInfo->Id != 75)
3968 {
3969 // generic autorepeats break generic non-delayed and channeled non-delayed spells
3971 {
3972 if (!s->GetSpellInfo()->IsActionAllowedChannel())
3973 {
3975 }
3976 }
3977
3979 }
3980 // special action: set first cast flag
3981 m_AutoRepeatFirstCast = true;
3982
3983 break;
3984 }
3985
3986 default:
3987 // other spell types don't break anything now
3988 break;
3989 }
3990
3991 // current spell (if it is still here) may be safely deleted now
3992 if (m_currentSpells[CSpellType])
3993 m_currentSpells[CSpellType]->SetReferencedFromCurrent(false);
3994
3995 // set new current spell
3996 m_currentSpells[CSpellType] = pSpell;
3997 pSpell->SetReferencedFromCurrent(true);
3998
3999 pSpell->m_selfContainer = &(m_currentSpells[pSpell->GetCurrentContainer()]);
4000}
CurrentSpellTypes GetCurrentContainer() const
Definition: Spell.cpp:7874
Spell ** m_selfContainer
Definition: Spell.h:609

References AddUnitState(), ASSERT, CURRENT_AUTOREPEAT_SPELL, CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, Spell::GetCastTime(), Spell::GetCurrentContainer(), GetCurrentSpell(), SpellInfo::Id, InterruptSpell(), m_AutoRepeatFirstCast, m_currentSpells, Spell::m_selfContainer, Spell::m_spellInfo, Spell::SetReferencedFromCurrent(), and UNIT_STATE_CASTING.

Referenced by Spell::prepare().

◆ setDeathState()

void Unit::setDeathState ( DeathState  s,
bool  despawn = false 
)
virtual

Reimplemented in Creature, Minion, Pet, and Player.

14443{
14444 // death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that
14445 // it can be used to check creation of death items (such as soul shards).
14446
14447 if (s != ALIVE && s != JUST_RESPAWNED)
14448 {
14449 CombatStop();
14452 ClearComboPointHolders(); // any combo points pointed to unit lost at it death
14453
14454 if (IsNonMeleeSpellCast(false))
14456
14457 UnsummonAllTotems(true);
14458 RemoveAllControlled(true);
14460 }
14461
14462 if (s == JUST_DIED)
14463 {
14464 // remove aurastates allowing special moves
14467
14468 GetMotionMaster()->Clear(false);
14470
14471 // Xinef: Remove Hover so the corpse can fall to the ground
14472 SetHover(false);
14473
14474 if (despawn)
14475 DisableSpline();
14476 else
14477 StopMoving();
14478
14479 // without this when removing IncreaseMaxHealth aura player may stuck with 1 hp
14480 // do not why since in IncreaseMaxHealth currenthealth is checked
14481 SetHealth(0);
14482 SetPower(getPowerType(), 0);
14483
14484 // Stop emote on death
14486
14487 // players in instance don't have ZoneScript, but they have InstanceScript
14489 zoneScript->OnUnitDeath(this);
14490 }
14491 else if (s == JUST_RESPAWNED)
14492 {
14493 RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground)
14494 }
14495
14496 m_deathState = s;
14497}
@ JUST_RESPAWNED
Definition: Unit.h:320
@ UNIT_FLAG_SKINNABLE
Definition: Unit.h:474
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1192
ZoneScript * GetZoneScript() const
Definition: Object.h:523
void ClearAllReactives()
Definition: Unit.cpp:17072
virtual bool SetHover(bool enable, bool packetOnly=false, bool updateAnimationTier=true)
Definition: Unit.cpp:20876
void ClearDiminishings()
Definition: Unit.h:1332
Definition: ZoneScript.h:27

References ALIVE, MotionMaster::Clear(), ClearAllReactives(), ThreatMgr::ClearAllThreat(), ClearComboPointHolders(), ClearDiminishings(), CombatStop(), HostileRefMgr::deleteReferences(), DisableSpline(), getHostileRefMgr(), WorldObject::GetInstanceScript(), GetMotionMaster(), getPowerType(), GetThreatMgr(), WorldObject::GetZoneScript(), InterruptNonMeleeSpells(), IsNonMeleeSpellCast(), JUST_DIED, JUST_RESPAWNED, m_deathState, MotionMaster::MoveIdle(), RemoveAllAurasOnDeath(), RemoveAllControlled(), Object::RemoveFlag(), SetHealth(), SetHover(), SetPower(), Object::SetUInt32Value(), StopMoving(), UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE, UNIT_NPC_EMOTESTATE, and UnsummonAllTotems().

Referenced by _ExitVehicle(), KillMagnetEvent::Execute(), Spell::finish(), WorldSession::HandlePetActionHelper(), AuraEffect::HandleSpiritOfRedemption(), Kill(), Creature::setDeathState(), and Player::setDeathState().

◆ SetDisableGravity()

◆ SetDisplayId()

◆ SetExtraUnitMovementFlags()

void Unit::SetExtraUnitMovementFlags ( uint16  f)
inline

◆ SetFacingTo()

void Unit::SetFacingTo ( float  ori)
20741{
20742 Movement::MoveSplineInit init(this);
20743 init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ(), false);
20745 init.DisableTransportPathTransformations(); // It makes no sense to target global orientation
20746 init.SetFacing(ori);
20747 init.Launch();
20748}
ObjectGuid GetTransGUID() const override
Definition: Unit.cpp:18894

References Movement::MoveSplineInit::DisableTransportPathTransformations(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetTransGUID(), HasUnitMovementFlag(), Movement::MoveSplineInit::Launch(), MOVEMENTFLAG_ONTRANSPORT, Movement::MoveSplineInit::MoveTo(), and Movement::MoveSplineInit::SetFacing().

Referenced by boss_twinemperorsAI::DoAction(), npc_arthas::npc_arthasAI::DoAction(), Spell::EffectDistract(), UtherBatteredHiltEvent::Execute(), DistractMovementGenerator::Finalize(), Creature::FocusTarget(), spell_item_unusual_compass::HandleDummy(), spell_drakkari_colossus_face_me::spell_drakkari_colossus_face_me_SpellScript::HandleScriptEffect(), boss_ragnaros::boss_ragnarosAI::JustDied(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::MovementInform(), npc_brann_bronzebeard_algalon::npc_brann_bronzebeard_algalonAI::MovementInform(), boss_onyxia::MovementInform(), npc_twilight_volunteer::MovementInform(), boss_eadric::boss_eadricAI::MovementInform(), boss_paletress::boss_paletressAI::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::MovementInform(), boss_professor_putricide::boss_professor_putricideAI::MovementInform(), boss_razorscale::boss_razorscaleAI::MovementInform(), npc_enslaved_proto_drake::npc_enslaved_proto_drakeAI::MovementInform(), npc_commander_eligor_dawnbringer::npc_commander_eligor_dawnbringerAI::MovementInform(), boss_illidan_stormrage::boss_illidan_stormrageAI::MovementInform(), boss_essence_of_suffering::boss_essence_of_sufferingAI::MovementInform(), boss_essence_of_desire::boss_essence_of_desireAI::MovementInform(), boss_lady_vashj::boss_lady_vashjAI::MovementInform(), boss_mr_smite::boss_mr_smiteAI::MovementInform(), boss_felmyst::boss_felmystAI::MovementInform(), boss_saviana_ragefire::boss_saviana_ragefireAI::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_spinestalker::npc_spinestalkerAI::MovementInform(), npc_rimefang::npc_rimefangAI::MovementInform(), npc_akama_shade::npc_akamaAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), gunship_npc_AI::MovementInform(), npc_gunship_boarding_addAI::MovementInform(), npc_gunship_mage::npc_gunship_mageAI::MovementInform(), boss_the_lich_king::boss_the_lich_kingAI::MovementInform(), boss_skadi_grauf::boss_skadi_graufAI::MovementInform(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), spell_lurker_below_spout::spell_lurker_below_spout_AuraScript::OnPeriodic(), npc_hover_disk::npc_hover_diskAI::PassengerBoarded(), SmartAI::PausePath(), SmartScript::ProcessAction(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::Reposition(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::Reposition(), Player::SetClientControl(), npc_tirion_fordring_tft::npc_tirion_fordringAI::SpellHit(), boss_heigan::boss_heiganAI::StartFightPhase(), CreatureAI::TriggerAlert(), RotateMovementGenerator::Update(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), boss_victor_nefarius::boss_victor_nefariusAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_partygoer::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_harrison_jones::npc_harrison_jonesAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_medivh_bm::npc_medivh_bmAI::UpdateAI(), boss_onyxia::UpdateAI(), npc_frost_sphere::npc_frost_sphereAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_pos_tyrannus_events::npc_pos_tyrannus_eventsAI::UpdateAI(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), npc_bloodmage_laurith::npc_bloodmage_laurithAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_warden_mellichar::npc_warden_mellicharAI::UpdateAI(), boss_kaelthas::boss_kaelthasAI::UpdateAI(), npc_pet_gen_plump_turkey::UpdateAI(), npc_general_andorov::UpdateEscortAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), npc_akama_illidan::npc_akama_illidanAI::UpdateEscortAI(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::WaypointReached(), npc_argent_soldier::npc_argent_soldierAI::WaypointReached(), and npc_ranger_lilatha::WaypointReached().

◆ SetFacingToObject()

void Unit::SetFacingToObject ( WorldObject object)
Todo:
figure out under what conditions creature will move towards object instead of facing it where it currently is.
20751{
20752 // never face when already moving
20753 if (!IsStopped())
20754 return;
20755
20757 Movement::MoveSplineInit init(this);
20758 init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ());
20759 init.SetFacing(GetAngle(object)); // when on transport, GetAngle will still return global coordinates (and angle) that needs transforming
20760 init.Launch();
20761}
bool IsStopped() const
Definition: Unit.h:2266

References Position::GetAngle(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), IsStopped(), Movement::MoveSplineInit::Launch(), Movement::MoveSplineInit::MoveTo(), and Movement::MoveSplineInit::SetFacing().

Referenced by npc_ranshalla::npc_ranshallaAI::DoChannelTorchSpell(), spell_yogg_saron_target_selectors::spell_yogg_saron_target_selectors_SpellScript::HandleScript(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::IsSummonedBy(), npc_oculus_drake::npc_oculus_drakeAI::IsSummonedBy(), npc_wintergarde_gryphon::IsSummonedBy(), npc_ranshalla::npc_ranshallaAI::JustDidDialogueStep(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::JustSummoned(), boss_illidan_stormrage::boss_illidan_stormrageAI::JustSummoned(), npc_drakuru_shackles::npc_drakuru_shacklesAI::LockRageclaw(), npc_scarlet_guard::npc_scarlet_guardAI::MoveInLineOfSight(), npc_mograine::npc_mograineAI::MoveInLineOfSight(), npc_fairbanks::npc_fairbanksAI::MoveInLineOfSight(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::MovementInform(), npc_hidden_cultist::npc_hidden_cultistAI::PreScript(), npc_jungle_punch_target::npc_jungle_punch_targetAI::proceedCwEvent(), SmartScript::ProcessAction(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), npc_dancing_flames::npc_dancing_flamesAI::ReceiveEmote(), npc_image_of_medivh::npc_image_of_medivhAI::Reset(), npc_bloodmage_laurith::npc_bloodmage_laurithAI::SetGUID(), npc_harrison_jones::npc_harrison_jonesAI::sGossipSelect(), npc_crusade_recruit::npc_crusade_recruitAI::sGossipSelect(), npc_forest_frog::npc_forest_frogAI::SpellHit(), npc_wounded_skirmisher::SpellHit(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), npc_commander_dawnforge::npc_commander_dawnforgeAI::Turn_to_eachother(), npc_commander_dawnforge::npc_commander_dawnforgeAI::Turn_to_Pathaleons_Image(), npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI(), boss_victor_nefarius::boss_victor_nefariusAI::UpdateAI(), boss_majordomo::boss_majordomoAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_eastvale_peasent::UpdateAI(), npc_partygoer::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_winterfin_playmate::UpdateAI(), npc_snowfall_glade_playmate::UpdateAI(), npc_the_biggest_tree::UpdateAI(), npc_high_oracle_soo_roo::UpdateAI(), npc_the_etymidian::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), npc_pilgrims_bounty_chair::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::UpdateAI(), npc_ulduar_expedition_engineer::npc_ulduar_expedition_engineerAI::UpdateAI(), npc_hidden_cultist::npc_hidden_cultistAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), boss_the_lurker_below::boss_the_lurker_belowAI::UpdateAI(), boss_wrath_scryer_soccothrates::boss_wrath_scryer_soccothratesAI::UpdateAI(), npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::UpdateAI(), npc_ranshalla::npc_ranshallaAI::WaypointReached(), npc_arthas::npc_arthasAI::WaypointReached(), npc_scarlet_miner::npc_scarlet_minerAI::WaypointReached(), and npc_kaya_flathoof::npc_kaya_flathoofAI::WaypointReached().

◆ SetFaction()

void Unit::SetFaction ( uint32  faction)
10030{
10032 if (GetTypeId() == TYPEID_UNIT)
10034}
void UpdateMoveInLineOfSightState()
Definition: Creature.cpp:2503

References Object::GetTypeId(), Object::SetUInt32Value(), Object::ToCreature(), TYPEID_UNIT, UNIT_FIELD_FACTIONTEMPLATE, and Creature::UpdateMoveInLineOfSightState().

Referenced by npc_mograine::npc_mograineAI::AshbringerEvent(), npc_hidden_cultist::npc_hidden_cultistAI::AttackPlayer(), GameObject::CastSpell(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), boss_algalon_the_observer::boss_algalon_the_observerAI::DamageTaken(), boss_freya::boss_freyaAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DestroyDoor(), boss_apothecary_hummel::boss_apothecary_hummelAI::DoAction(), npc_apothecary_genericAI::DoAction(), npc_coren_direbrew::DoAction(), npc_direbrew_antagonist::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::DoAction(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), Spell::EffectSummonType(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::EnterEvadeMode(), BattlegroundEY::EventTeamCapturedPoint(), AuraEffect::HandleAuraModFaction(), BattlegroundIC::HandleCapturedNodes(), spell_q12096_q12092_dummy::spell_q12096_q12092_dummy_SpellScript::HandleDummy(), spell_q11919_q11940_drake_hunt::spell_q11919_q11940_drake_hunt_AuraScript::HandleEffectRemove(), modify_commandscript::HandleModifyFactionCommand(), npc_commandscript::HandleNpcSetFactionIdCommand(), npc_commandscript::HandleNpcSetFactionTempIdCommand(), spell_mutate_explode_bug::HandleOnHit(), spell_q10612_10613_the_fel_and_the_furious::spell_q10612_10613_the_fel_and_the_furious_SpellScript::HandleScriptEffect(), spell_item_draenic_pale_ale::HandleSummon(), npc_cork_gizelton::npc_cork_gizeltonAI::ImmuneFlagSet(), boss_vaelastrasz::boss_vaelAI::Initialize(), boss_majordomo::boss_majordomoAI::InitializeAI(), npc_general_andorov::InitializeAI(), npc_sergeant_bly::npc_sergeant_blyAI::InitializeAI(), Minion::InitStats(), TempSummon::InitStats(), InitTamedPet(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), npc_enraged_spirit::npc_enraged_spiritAI::JustDied(), FollowerAI::JustRespawned(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), boss_volkhan::boss_volkhanAI::JustSummoned(), boss_balinda::boss_balindaAI::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), boss_archimonde::boss_archimondeAI::JustSummoned(), boss_broggok::boss_broggokAI::JustSummoned(), Pet::LoadPetFromDB(), npc_scarlet_guard::npc_scarlet_guardAI::MoveInLineOfSight(), npc_mograine::npc_mograineAI::MoveInLineOfSight(), npc_fairbanks::npc_fairbanksAI::MoveInLineOfSight(), boss_twilight_corrupter::MoveInLineOfSight(), BattlegroundAB::NodeOccupied(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::npc_scarlet_miner_cartAI(), spell_brewfest_reveler_transform::OnApply(), BattlefieldWG::OnCreatureCreate(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::OnCreatureCreate(), instance_nexus::instance_nexus_InstanceMapScript::OnCreatureCreate(), instance_black_temple::instance_black_temple_InstanceMapScript::OnCreatureCreate(), npc_salsalabim::OnGossipHello(), npc_raliq_the_drunk::OnGossipSelect(), npc_floon::OnGossipSelect(), npc_cooshcoosh::OnGossipSelect(), boss_azuregos::OnGossipSelect(), npc_prospector_remtravel::OnQuestAccept(), npc_gilthares::OnQuestAccept(), npc_lakota_windsong::OnQuestAccept(), npc_paoka_swiftmountain::OnQuestAccept(), npc_engineer_helice::OnQuestAccept(), npc_maghar_captive::OnQuestAccept(), npc_maxx_a_million_escort::OnQuestAccept(), npc_earthmender_wilda::OnQuestAccept(), npc_bartleby::OnQuestAccept(), npc_calvin_montague::OnQuestAccept(), npc_kaya_flathoof::OnQuestAccept(), npc_wizzlecrank_shredder::OnQuestAccept(), npc_ame::OnQuestAccept(), npc_ranshalla::OnQuestAccept(), npc_lurgglbr::OnQuestAccept(), npc_mootoo_the_younger::OnQuestAccept(), npc_apothecary_hanes::OnQuestAccept(), npc_bessy::OnQuestAccept(), npc_isla_starmane::OnQuestAccept(), go_crystalline_tear::OnQuestAccept(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::PassengerBoarded(), npc_frosthound::npc_frosthoundAI::PassengerBoarded(), BattlegroundAV::PopulateNode(), npc_chicken_cluck::npc_chicken_cluckAI::ReceiveEmote(), npc_plucky::npc_pluckyAI::ReceiveEmote(), RemoveCharmedBy(), boss_doomrel::boss_doomrelAI::Reset(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_servant_quarters::Reset(), npc_unworthy_initiate::npc_unworthy_initiateAI::Reset(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::Reset(), boss_apothecary_hummel::boss_apothecary_hummelAI::Reset(), npc_bartleby::npc_bartlebyAI::Reset(), npc_coren_direbrew::Reset(), npc_direbrew_minion::Reset(), npc_aquementas::npc_aquementasAI::Reset(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::Reset(), npc_plucky::npc_pluckyAI::Reset(), boss_grobbulus_poison_cloud::boss_grobbulus_poison_cloudAI::Reset(), brann_bronzebeard::brann_bronzebeardAI::Reset(), boss_algalon_the_observer::boss_algalon_the_observerAI::Reset(), npc_thassarian2::npc_thassarian2AI::Reset(), npc_future_you::npc_future_youAI::Reset(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::Reset(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::Reset(), npc_captured_rageclaw::npc_captured_rageclawAI::Reset(), npc_aeranas::npc_aeranasAI::Reset(), socrethar::socretharAI::Reset(), npc_enslaved_netherwing_drake::npc_enslaved_netherwing_drakeAI::Reset(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::Reset(), npc_floon::npc_floonAI::Reset(), npc_cooshcoosh::npc_cooshcooshAI::Reset(), npc_chicken_cluck::npc_chicken_cluckAI::Reset(), RestoreFaction(), SetCharmedBy(), Player::SetFactionForRace(), Player::SetGameMaster(), npc_captain_saeed::npc_captain_saeedAI::SetGUID(), npc_your_inner_turmoil::npc_your_inner_turmoilAI::setphase(), BattlegroundIC::SetupBattleground(), boss_victor_nefarius::boss_victor_nefariusAI::sGossipSelect(), Battlefield::SpawnCreature(), npc_captured_rageclaw::npc_captured_rageclawAI::SpellHit(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::SpellHit(), npc_crusade_persuaded::npc_crusade_persuadedAI::SpellHit(), npc_yenniku::npc_yennikuAI::SpellHit(), npc_enslaved_netherwing_drake::npc_enslaved_netherwing_drakeAI::SpellHit(), npc_belnistrasz::npc_belnistraszAI::sQuestAccept(), npc_professor_phizzlethorpe::npc_professor_phizzlethorpeAI::sQuestAccept(), npc_ranger_lilatha::sQuestAccept(), npc_corporal_keeshan::npc_corporal_keeshanAI::sQuestAccept(), npc_muglash::npc_muglashAI::sQuestAccept(), npc_shay_leafrunner::npc_shay_leafrunnerAI::sQuestAccept(), npc_wounded_blood_elf::npc_wounded_blood_elfAI::sQuestAccept(), FollowerAI::StartFollow(), pyrewood_ambush::pyrewood_ambushAI::SummonCreatureWithRandomTarget(), boss_majordomo::boss_majordomoAI::SummonedCreatureDies(), Spell::SummonGuardian(), boss_malchezaar::boss_malchezaarAI::SummonInfernal(), Player::SummonPet(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), WorldObject::SummonTrigger(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_shade_of_aran::boss_aranAI::UpdateAI(), npc_death_knight_initiate::npc_death_knight_initiateAI::UpdateAI(), npc_unworthy_initiate::npc_unworthy_initiateAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), npc_yenniku::npc_yennikuAI::UpdateAI(), boss_akilzon::boss_akilzonAI::UpdateAI(), boss_archimonde::boss_archimondeAI::UpdateAI(), npc_giant_infernal::npc_giant_infernalAI::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), npc_aquementas::npc_aquementasAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), npc_sergeant_bly::npc_sergeant_blyAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), npc_aeranas::npc_aeranasAI::UpdateAI(), socrethar::socretharAI::UpdateAI(), npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI::UpdateAI(), Creature::UpdateEntry(), npc_magwin::npc_magwinAI::UpdateEscortAI(), and npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::WaypointReached().

◆ SetFeared()

void Unit::SetFeared ( bool  apply,
Unit fearedBy = nullptr,
bool  isFear = false 
)
protected
18418{
18419 if (apply)
18420 {
18421 SetTarget();
18422 GetMotionMaster()->MoveFleeing(fearedBy, isFear ? 0 : sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY));
18423
18424 if (GetTypeId() == TYPEID_PLAYER)
18425 {
18426 sScriptMgr->AnticheatSetSkipOnePacketForASH(ToPlayer(), true);
18427 }
18428 }
18429 else
18430 {
18431 if (IsAlive())
18432 {
18433 if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == FLEEING_MOTION_TYPE)
18434 {
18436 StopMoving();
18437 }
18438
18439 if (GetVictim())
18441 }
18442 }
18443
18444 // xinef: block / allow control to real mover (eg. charmer)
18445 if (GetTypeId() == TYPEID_PLAYER)
18446 {
18447 if (m_movedByPlayer)
18448 m_movedByPlayer->ToPlayer()->SetClientControl(this, !apply); // verified
18449 //else
18450 // ToPlayer()->SetClientControl(this, !apply);
18451 }
18452}
@ FLEEING_MOTION_TYPE
Definition: MotionMaster.h:47
@ CONFIG_CREATURE_FAMILY_FLEE_DELAY
Definition: IWorld.h:280
void MoveFleeing(Unit *enemy, uint32 time=0)
Definition: MotionMaster.cpp:657

References CONFIG_CREATURE_FAMILY_FLEE_DELAY, FLEEING_MOTION_TYPE, Object::GetGUID(), GetMotionMaster(), Object::GetTypeId(), GetVictim(), IsAlive(), m_movedByPlayer, MOTION_SLOT_CONTROLLED, MotionMaster::MoveFleeing(), MotionMaster::MovementExpired(), Player::SetClientControl(), SetTarget(), sScriptMgr, StopMoving(), sWorld, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by SetControlled().

◆ SetFeatherFall()

bool Unit::SetFeatherFall ( bool  enable,
bool  packetOnly = false 
)
virtual

◆ SetFullHealth()

◆ SetHealth()

void Unit::SetHealth ( uint32  val)
15366{
15367 if (getDeathState() == JUST_DIED)
15368 val = 0;
15369 else if (GetTypeId() == TYPEID_PLAYER && getDeathState() == DEAD)
15370 val = 1;
15371 else
15372 {
15373 uint32 maxHealth = GetMaxHealth();
15374 if (maxHealth < val)
15375 val = maxHealth;
15376 }
15377
15378 float prevHealthPct = GetHealthPct();
15379
15381
15382 // mobs that are now or were below 30% need to update their speed
15383 if (GetTypeId() == TYPEID_UNIT && (prevHealthPct < 30.0 || HealthBelowPct(30)))
15384 {
15385 UpdateSpeed(MOVE_RUN, false);
15386 }
15387
15388 // group update
15389 if (GetTypeId() == TYPEID_PLAYER)
15390 {
15391 Player* player = ToPlayer();
15392 if (player->NeedSendSpectatorData())
15394
15395 if (player->GetGroup())
15397 }
15398 else if (Pet* pet = ToCreature()->ToPet())
15399 {
15400 if (pet->isControlled())
15401 {
15402 if (Unit* owner = GetOwner())
15403 if (Player* player = owner->ToPlayer())
15404 {
15405 if (player->NeedSendSpectatorData() && pet->GetCreatureTemplate()->family)
15406 ArenaSpectator::SendCommand_UInt32Value(player->FindMap(), player->GetGUID(), "PHP", (uint32)pet->GetHealthPct());
15407
15408 if (player->GetGroup())
15410 }
15411 }
15412 }
15413}
@ GROUP_UPDATE_FLAG_CUR_HP
Definition: Group.h:100
@ GROUP_UPDATE_FLAG_PET_CUR_HP
Definition: Group.h:112
void SendCommand_UInt32Value(T *o, ObjectGuid targetGUID, const char *prefix, uint32 t)
Definition: ArenaSpectator.h:62
bool NeedSendSpectatorData() const
Definition: Player.cpp:15278
void SetGroupUpdateFlag(uint32 flag)
Definition: Player.h:2424
float GetHealthPct() const
Definition: Unit.h:1448

References DEAD, WorldObject::FindMap(), getDeathState(), Player::GetGroup(), Object::GetGUID(), GetHealthPct(), GetMaxHealth(), GetOwner(), Object::GetTypeId(), GROUP_UPDATE_FLAG_CUR_HP, GROUP_UPDATE_FLAG_PET_CUR_HP, HealthBelowPct(), JUST_DIED, MOVE_RUN, Player::NeedSendSpectatorData(), ArenaSpectator::SendCommand_UInt32Value(), Player::SetGroupUpdateFlag(), Object::SetUInt32Value(), Object::ToCreature(), ToPet(), Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, UNIT_FIELD_HEALTH, and UpdateSpeed().

Referenced by boss_twilight_halion::boss_twilight_halionAI::boss_twilight_halionAI(), Player::BuildPlayerRepop(), npc_mograine::npc_mograineAI::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_alar::boss_alarAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), boss_viscidus::DamageTaken(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DamageTaken(), DealDamage(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_xt002::boss_xt002AI::DoAction(), npc_xt002_heart::npc_xt002_heartAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), Spell::EffectResurrectPet(), Spell::EffectSelfResurrect(), Spell::EffectSummonPet(), Spell::EffectSummonType(), boss_malchezaar::boss_malchezaarAI::EnfeebleResetHealth(), boss_prince_keleseth_icc::boss_prince_kelesethAI::EnterEvadeMode(), boss_prince_taldaram_icc::boss_prince_taldaramAI::EnterEvadeMode(), boss_prince_valanar_icc::boss_prince_valanarAI::EnterEvadeMode(), boss_halazzi::boss_halazziAI::EnterPhase(), AuraEffect::HandleAuraModIncreaseHealth(), AuraEffect::HandleAuraModIncreaseHealthPercent(), AuraEffect::HandleAuraModIncreaseMaxHealth(), spell_oculus_soar::spell_oculus_soarAuraScript::HandleEffectPeriodic(), modify_commandscript::HandleModifyHPCommand(), AuraEffect::HandleModTotalPercentStat(), npc_commandscript::HandleNpcSetLevelCommand(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), spell_stinky_precious_decimate::spell_stinky_precious_decimate_SpellScript::HandleScript(), AuraEffect::HandleSpiritOfRedemption(), npc_pet_pri_lightwell::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustReachedHome(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustReachedHome(), boss_prince_valanar_icc::boss_prince_valanarAI::JustReachedHome(), npc_dirt_mound::JustSummoned(), boss_skeram::JustSummoned(), boss_midnight::boss_midnightAI::JustSummoned(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustSummoned(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustSummoned(), boss_harbinger_skyriss::boss_harbinger_skyrissAI::JustSummoned(), Creature::LoadCreatureFromDB(), Player::LoadFromDB(), Pet::LoadPetFromDB(), ModifyHealth(), boss_grand_champion::boss_grand_championAI::MovementInform(), npc_nether_drake::npc_nether_drakeAI::MovementInform(), npc_corrupted_totem::npc_corrupted_totem(), npc_xt002_life_spark::npc_xt002_life_sparkAI::npc_xt002_life_sparkAI(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), PretendToDie(), Player::ProcessDelayedOperations(), boss_vaelastrasz::boss_vaelAI::Reset(), boss_kalecgos::boss_kalecgosAI::Reset(), npc_draenei_survivor::npc_draenei_survivorAI::Reset(), npc_injured_draenei::npc_injured_draeneiAI::Reset(), boss_prince_keleseth_icc::boss_prince_kelesethAI::Reset(), boss_prince_taldaram_icc::boss_prince_taldaramAI::Reset(), boss_prince_valanar_icc::boss_prince_valanarAI::Reset(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::Reset(), boss_murmur::boss_murmurAI::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), Player::ResetAllPowers(), Player::RestoreHealthAfterDuel(), Player::ResurectUsingRequestData(), Player::ResurrectPlayer(), Creature::SelectLevel(), setDeathState(), SetFullHealth(), SetMaxHealth(), boss_headless_horseman::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), boss_ahune::boss_ahuneAI::SummonedCreatureDespawn(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), boss_akilzon::boss_akilzonAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::UpdateAI(), npc_phase_hunter::npc_phase_hunterAI::UpdateAI(), Creature::UpdateEntry(), and boss_twin_valkyrAI::UpdateSharedHealth().

◆ SetHover()

bool Unit::SetHover ( bool  enable,
bool  packetOnly = false,
bool  updateAnimationTier = true 
)
virtual

Reimplemented in Creature, and Player.

20877{
20879 return false;
20880
20881 float hoverHeight = GetFloatValue(UNIT_FIELD_HOVERHEIGHT);
20882
20883 if (enable)
20884 {
20886 if (hoverHeight && GetPositionZ() - GetFloorZ() < hoverHeight)
20887 UpdateHeight(GetPositionZ() + hoverHeight);
20888 }
20889 else
20890 {
20892 if (hoverHeight && (!isDying() || GetTypeId() != TYPEID_UNIT))
20893 {
20894 float newZ = std::max<float>(GetFloorZ(), GetPositionZ() - hoverHeight);
20896 UpdateHeight(newZ);
20897 }
20898 SendMovementFlagUpdate(); // pussywizard: needed for falling after death (instead of falling onto air at hover height)
20899 }
20900
20901 return true;
20902}
void UpdateAllowedPositionZ(float x, float y, float &z, float *groundZ=nullptr) const
Definition: Object.cpp:1554
float GetFloorZ() const
Definition: Object.cpp:3064
void UpdateHeight(float newZ)
Only server-side height update, does not broadcast to client.
Definition: Unit.cpp:20198
void SendMovementFlagUpdate(bool self=false)
Definition: Unit.cpp:16852

References AddUnitMovementFlag(), Object::GetFloatValue(), WorldObject::GetFloorZ(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Object::GetTypeId(), HasUnitMovementFlag(), isDying(), MOVEMENTFLAG_HOVER, RemoveUnitMovementFlag(), SendMovementFlagUpdate(), TYPEID_UNIT, UNIT_FIELD_HOVERHEIGHT, WorldObject::UpdateAllowedPositionZ(), and UpdateHeight().

Referenced by AuraEffect::HandleAuraHover(), debug_commandscript::HandleDebugMoveflagsCommand(), setDeathState(), Creature::SetHover(), and Player::SetHover().

◆ SetImmuneToAll()

void Unit::SetImmuneToAll ( bool  apply,
bool  keepCombat = false 
)
inline
1678{ SetImmuneToPC(apply, keepCombat); SetImmuneToNPC(apply, keepCombat); }
void SetImmuneToNPC(bool apply, bool keepCombat=false)
Definition: Unit.cpp:13532

References SetImmuneToNPC(), and SetImmuneToPC().

Referenced by spell_the_lich_king_trigger_vile_spirit::spell_the_lich_king_trigger_vile_spirit_SpellScript::ActivateSpirit(), boss_chromaggus::boss_chromaggusAI::boss_chromaggusAI(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::DamageTaken(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_warden_mellichar::npc_warden_mellicharAI::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_apothecary_hummel::boss_apothecary_hummelAI::DoAction(), npc_apothecary_genericAI::DoAction(), npc_twilight_volunteer::DoAction(), boss_taldaram::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), npc_living_constellation::npc_living_constellationAI::DoAction(), boss_broggok::boss_broggokAI::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), boss_kelidan_the_breaker::boss_kelidan_the_breakerAI::DoAction(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::DoAction(), boss_skeram::DoTeleport(), Spell::EffectSummonType(), boss_falric::boss_falricAI::EnterCombat(), boss_marwyn::boss_marwynAI::EnterCombat(), boss_sister_svalna::boss_sister_svalnaAI::EnterCombat(), npc_ghostly_priest::npc_ghostly_priestAI::EnterEvadeMode(), npc_phantom_mage::npc_phantom_mageAI::EnterEvadeMode(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::EnterEvadeMode(), npc_spectral_footman::npc_spectral_footmanAI::EnterEvadeMode(), npc_tortured_rifleman::npc_tortured_riflemanAI::EnterEvadeMode(), UtherBatteredHiltEvent::Execute(), spell_uldaman_stoned::spell_uldaman_stoned_AuraScript::HandleEffectApply(), spell_gen_creature_permanent_feign_death::HandleEffectApply(), spell_uldaman_stoned::spell_uldaman_stoned_AuraScript::HandleEffectRemove(), spell_q11919_q11940_drake_hunt::spell_q11919_q11940_drake_hunt_AuraScript::HandleEffectRemove(), spell_gen_creature_permanent_feign_death::HandleEffectRemove(), spell_item_draenic_pale_ale::HandleSummon(), boss_majordomo::boss_majordomoAI::InitializeAI(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::InitializeAI(), boss_captain_skarloc::boss_captain_skarlocAI::InitializeAI(), npc_shay_leafrunner::npc_shay_leafrunnerAI::InitializeAI(), boss_taldaram::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::InitializeAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::InitializeAI(), boss_prince_valanar_icc::boss_prince_valanarAI::InitializeAI(), npc_lord_arete::npc_lord_areteAI::InitializeAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::InitializeAI(), boss_dalliah_the_doomsayer::boss_dalliah_the_doomsayerAI::InitializeAI(), boss_wrath_scryer_soccothrates::boss_wrath_scryer_soccothratesAI::InitializeAI(), Player::InitStatsForLevel(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::IsSummonedBy(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustRespawned(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_skeram::JustSummoned(), boss_majordomo::boss_majordomoAI::JustSummoned(), boss_captain_skarloc::boss_captain_skarlocAI::JustSummoned(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::JustSummoned(), npc_dkc1_gothik::npc_dkc1_gothikAI::MoveInLineOfSight(), boss_taldaram::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), boss_sister_svalna::boss_sister_svalnaAI::MovementInform(), npc_enslaved_proto_drake::npc_enslaved_proto_drakeAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_memory::npc_memoryAI::npc_memoryAI(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::npc_scarlet_miner_cartAI(), npc_natrualist_bite::OnGossipSelect(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::Reset(), boss_rend_blackhand::boss_rend_blackhandAI::Reset(), boss_ragnaros::boss_ragnarosAI::Reset(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::Reset(), boss_mandokir::boss_mandokirAI::Reset(), boss_skeram::Reset(), boss_jedoga_shadowseeker::Reset(), boss_black_knight::boss_black_knightAI::Reset(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::Reset(), boss_grand_champion::boss_grand_championAI::Reset(), boss_falric::boss_falricAI::Reset(), boss_marwyn::boss_marwynAI::Reset(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::Reset(), boss_sister_svalna::boss_sister_svalnaAI::Reset(), boss_svala::boss_svalaAI::Reset(), npc_thassarian::npc_thassarianAI::Reset(), boss_illidan_stormrage::boss_illidan_stormrageAI::Reset(), boss_shade_of_akama::boss_shade_of_akamaAI::Reset(), boss_broggok::boss_broggokAI::Reset(), boss_kelidan_the_breaker::boss_kelidan_the_breakerAI::Reset(), npc_warden_mellichar::npc_warden_mellicharAI::Reset(), boss_dalliah_the_doomsayer::boss_dalliah_the_doomsayerAI::Reset(), boss_harbinger_skyriss::boss_harbinger_skyrissAI::Reset(), boss_wrath_scryer_soccothrates::boss_wrath_scryer_soccothratesAI::Reset(), instance_blood_furnace::instance_blood_furnace_InstanceMapScript::ResetPrisoner(), boss_svala::boss_svalaAI::SetData(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::SetData(), boss_chromaggus::boss_chromaggusAI::SetGUID(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), npc_shay_leafrunner::npc_shay_leafrunnerAI::sQuestAccept(), boss_majordomo::boss_majordomoAI::SummonedCreatureDies(), boss_jedoga_shadowseeker::SummonedCreatureDies(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), boss_captain_skarloc::boss_captain_skarlocAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_skeram::UpdateAI(), npc_memory::npc_memoryAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_shade_of_akama::boss_shade_of_akamaAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), boss_wrath_scryer_soccothrates::boss_wrath_scryer_soccothratesAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), and npc_franklin::npc_franklinAI::UpdateAI().

◆ SetImmuneToNPC()

◆ SetImmuneToPC()

void Unit::SetImmuneToPC ( bool  apply,
bool  keepCombat = false 
)
13524{
13525 (void)keepCombat;
13526 if (apply)
13528 else
13530}

References RemoveUnitFlag(), SetUnitFlag(), and UNIT_FLAG_IMMUNE_TO_PC.

Referenced by boss_victor_nefarius::boss_victor_nefariusAI::BeginEvent(), boss_the_lich_king::boss_the_lich_kingAI::boss_the_lich_kingAI(), ClearInCombat(), npc_calvin_montague::npc_calvin_montagueAI::DamageTaken(), boss_apothecary_hummel::boss_apothecary_hummelAI::DoAction(), npc_apothecary_genericAI::DoAction(), npc_coren_direbrew::DoAction(), npc_direbrew_antagonist::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), spell_q11396_11399_force_shield_arcane_purple_x3::HandleEffectApply(), spell_q11396_11399_force_shield_arcane_purple_x3::HandleEffectRemove(), boss_the_lich_king::boss_the_lich_kingAI::JustReachedHome(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::JustSummoned(), npc_spinestalker::npc_spinestalkerAI::MovementInform(), npc_rimefang::npc_rimefangAI::MovementInform(), npc_omen::npc_omenAI::MovementInform(), npc_zelfrax::npc_zelfraxAI::MovementInform(), npc_omen::npc_omenAI::npc_omenAI(), npc_death_knight_initiate::OnGossipSelect(), instance_ulduar::instance_ulduar_InstanceMapScript::OnPlayerEnter(), npc_calvin_montague::OnQuestAccept(), npc_kaya_flathoof::OnQuestAccept(), boss_doomrel::boss_doomrelAI::Reset(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::Reset(), npc_unworthy_initiate::npc_unworthy_initiateAI::Reset(), npc_a_special_surprise::npc_a_special_surpriseAI::Reset(), npc_calvin_montague::npc_calvin_montagueAI::Reset(), npc_coren_direbrew::Reset(), boss_general_zarithrian::boss_general_zarithrianAI::Reset(), boss_gothik::boss_gothikAI::Reset(), boss_algalon_the_observer::boss_algalon_the_observerAI::Reset(), npc_venture_co_straggler::npc_venture_co_stragglerAI::Reset(), boss_magtheridon::boss_magtheridonAI::Reset(), SetImmuneToAll(), SetInCombatState(), boss_victor_nefarius::boss_victor_nefariusAI::sGossipSelect(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::SpellHit(), npc_infernal_attacker::npc_infernal_attackerAI::SpellHit(), npc_venture_co_straggler::npc_venture_co_stragglerAI::SpellHit(), npc_unworthy_initiate::npc_unworthy_initiateAI::UpdateAI(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_magtheridon::boss_magtheridonAI::UpdateAI(), and npc_tallhorn_stag::npc_tallhorn_stagAI::UpdateAI().

◆ SetInCombatState()

void Unit::SetInCombatState ( bool  PvP,
Unit enemy = nullptr,
uint32  duration = 0 
)
13645{
13646 // only alive units can be in combat
13647 if (!IsAlive())
13648 return;
13649
13650 if (PvP)
13651 m_CombatTimer = std::max<uint32>(GetCombatTimer(), std::max<uint32>(5500, duration));
13652 else if (duration)
13653 m_CombatTimer = std::max<uint32>(GetCombatTimer(), duration);
13654
13656 return;
13657
13658 // xinef: if we somehow engage in combat (scripts, dunno) with player, remove this flag so he can fight back
13660 SetImmuneToPC(false); // unit has engaged in combat, remove immunity so players can fight back
13661
13662 if (IsInCombat())
13663 return;
13664
13666
13667 if (Creature* creature = ToCreature())
13668 {
13669 // Set home position at place of engaging combat for escorted creatures
13670 if ((IsAIEnabled && creature->AI()->IsEscorted()) ||
13671 GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE ||
13672 GetMotionMaster()->GetCurrentMovementGeneratorType() == ESCORT_MOTION_TYPE)
13673 creature->SetHomePosition(GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
13674
13675 if (enemy)
13676 {
13677 if (IsAIEnabled)
13678 creature->AI()->EnterCombat(enemy);
13679
13680 if (creature->GetFormation())
13681 creature->GetFormation()->MemberEngagingTarget(creature, enemy);
13682
13683 sScriptMgr->OnUnitEnterCombat(creature, enemy);
13684 }
13685
13686 creature->RefreshSwimmingFlag();
13687
13688 if (IsPet())
13689 {
13690 UpdateSpeed(MOVE_RUN, true);
13691 UpdateSpeed(MOVE_SWIM, true);
13692 UpdateSpeed(MOVE_FLIGHT, true);
13693 }
13694
13695 if (!(creature->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_ALLOW_MOUNTED_COMBAT))
13696 Dismount();
13697 if (!IsStandState()) // pussywizard: already done in CombatStart(target, initialAggro) for the target, but when aggro'ing from MoveInLOS CombatStart is not called!
13699 }
13700
13701 for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();)
13702 {
13703 Unit* controlled = *itr;
13704 ++itr;
13705
13706 // Xinef: Dont set combat for passive units, they will evade in next update...
13707 if (controlled->GetTypeId() == TYPEID_UNIT && controlled->ToCreature()->HasReactState(REACT_PASSIVE))
13708 continue;
13709
13710 controlled->SetInCombatState(PvP, enemy, duration);
13711 }
13712
13713 if (Player* player = this->ToPlayer())
13714 {
13715 sScriptMgr->OnPlayerEnterCombat(player, enemy);
13716 }
13717}
@ MOVE_FLIGHT
Definition: Unit.h:384
@ MOVE_SWIM
Definition: Unit.h:381
@ ESCORT_MOTION_TYPE
Definition: MotionMaster.h:55
@ WAYPOINT_MOTION_TYPE
Definition: MotionMaster.h:39
@ CREATURE_TYPE_NON_COMBAT_PET
Definition: SharedDefines.h:2611
@ CREATURE_TYPE_FLAG_ALLOW_MOUNTED_COMBAT
Definition: SharedDefines.h:2678
bool HasReactState(ReactStates state) const
Definition: Creature.h:91
uint32 GetCombatTimer() const
Definition: Unit.h:1698
void SetInCombatState(bool PvP, Unit *enemy=nullptr, uint32 duration=0)
Definition: Unit.cpp:13644
bool IsStandState() const
Definition: Unit.cpp:16868

References CREATURE_TYPE_FLAG_ALLOW_MOUNTED_COMBAT, CREATURE_TYPE_NON_COMBAT_PET, Dismount(), ESCORT_MOTION_TYPE, GetCharmerOrOwnerPlayerOrPlayerItself(), GetCombatTimer(), GetCreatureType(), GetMotionMaster(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Object::GetTypeId(), Creature::HasReactState(), HasUnitState(), IsAIEnabled, IsAlive(), IsImmuneToPC(), IsInCombat(), IsPet(), IsStandState(), m_CombatTimer, m_Controlled, MOVE_FLIGHT, MOVE_RUN, MOVE_SWIM, REACT_PASSIVE, SetImmuneToPC(), SetInCombatState(), SetStandState(), SetUnitFlag(), sScriptMgr, Object::ToCreature(), Object::ToPlayer(), TYPEID_UNIT, UNIT_FLAG_IN_COMBAT, UNIT_STAND_STATE_STAND, UNIT_STATE_EVADE, UpdateSpeed(), and WAYPOINT_MOTION_TYPE.

Referenced by Spell::DoSpellHitOnUnit(), SetInCombatState(), and SetInCombatWith().

◆ SetInCombatWith()

void Unit::SetInCombatWith ( Unit enemy,
uint32  duration = 0 
)
13498{
13499 // Xinef: Dont allow to start combat with triggers
13500 if (enemy->GetTypeId() == TYPEID_UNIT && enemy->ToCreature()->IsTrigger())
13501 return;
13502
13503 Unit* eOwner = enemy->GetCharmerOrOwnerOrSelf();
13504 if (eOwner->IsPvP() || eOwner->IsFFAPvP())
13505 {
13506 SetInCombatState(true, enemy, duration);
13507 return;
13508 }
13509
13510 // check for duel
13511 if (eOwner->GetTypeId() == TYPEID_PLAYER && eOwner->ToPlayer()->duel)
13512 {
13513 Unit const* myOwner = GetCharmerOrOwnerOrSelf();
13514 if (((Player const*)eOwner)->duel->Opponent == myOwner)
13515 {
13516 SetInCombatState(true, enemy, duration);
13517 return;
13518 }
13519 }
13520 SetInCombatState(false, enemy, duration);
13521}

References Player::duel, GetCharmerOrOwnerOrSelf(), Object::GetTypeId(), IsFFAPvP(), IsPvP(), Creature::IsTrigger(), SetInCombatState(), Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, and TYPEID_UNIT.

Referenced by Attack(), npc_daphne_stilwell::npc_daphne_stilwellAI::AttackStart(), npc_zelfrax::npc_zelfraxAI::AttackStart(), CombatStart(), CombatStartOnCast(), npc_centrifuge_construct::npc_centrifuge_constructAI::DamageTaken(), Spell::DoAllEffectOnTarget(), CreatureAI::DoZoneInCombat(), boss_sapphiron::boss_sapphironAI::EnterCombatSelfFunction(), spell_herald_volzaj_insanity::HandleDummyEffect(), boss_chromaggus::boss_chromaggusAI::PathEndReached(), SmartScript::ProcessAction(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_addAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), and npc_phase_hunter::npc_phase_hunterAI::UpdateAI().

◆ SetInFront()

◆ SetInstantCast()

void Unit::SetInstantCast ( bool  set)
inline
2436{ _instantCast = set; }

References _instantCast.

Referenced by AuraEffect::HandleModCastingSpeed().

◆ SetLastDamagedTargetGuid()

void Unit::SetLastDamagedTargetGuid ( ObjectGuid const &  guid)
inline

◆ SetLastExtraAttackSpell()

void Unit::SetLastExtraAttackSpell ( uint32  spellId)
inline
1569{ _lastExtraAttackSpell = spellId; }

References _lastExtraAttackSpell.

Referenced by Spell::_handle_finish_phase().

◆ SetLastManaUse()

void Unit::SetLastManaUse ( uint32  spellCastTime)
inline
2217{ m_lastManaUse = spellCastTime; }

References m_lastManaUse.

Referenced by Spell::TakePower().

◆ SetLevel()

◆ SetMaxHealth()

void Unit::SetMaxHealth ( uint32  val)
15416{
15417 if (!val)
15418 val = 1;
15419
15420 uint32 health = GetHealth();
15422
15423 // group update
15424 if (GetTypeId() == TYPEID_PLAYER)
15425 {
15426 Player* player = ToPlayer();
15427 if (player->NeedSendSpectatorData())
15429
15430 if (player->GetGroup())
15432 }
15433 else if (Pet* pet = ToCreature()->ToPet())
15434 {
15435 if (pet->isControlled())
15436 {
15437 if (Unit* owner = GetOwner())
15438 if (Player* player = owner->ToPlayer())
15439 {
15440 if (player->NeedSendSpectatorData() && pet->GetCreatureTemplate()->family)
15441 ArenaSpectator::SendCommand_UInt32Value(player->FindMap(), player->GetGUID(), "PHP", (uint32)pet->GetHealthPct());
15442
15443 if (player->GetGroup())
15445 }
15446 }
15447 }
15448
15449 if (val < health)
15450 SetHealth(val);
15451}
@ GROUP_UPDATE_FLAG_MAX_HP
Definition: Group.h:101
@ GROUP_UPDATE_FLAG_PET_MAX_HP
Definition: Group.h:113

References WorldObject::FindMap(), Player::GetGroup(), Object::GetGUID(), GetHealth(), GetOwner(), Object::GetTypeId(), GROUP_UPDATE_FLAG_MAX_HP, GROUP_UPDATE_FLAG_PET_MAX_HP, Player::NeedSendSpectatorData(), ArenaSpectator::SendCommand_UInt32Value(), Player::SetGroupUpdateFlag(), SetHealth(), Object::SetUInt32Value(), Object::ToCreature(), ToPet(), Object::ToPlayer(), TYPEID_PLAYER, and UNIT_FIELD_MAXHEALTH.

Referenced by boss_xt002::boss_xt002AI::DoAction(), Spell::EffectSummonType(), boss_halazzi::boss_halazziAI::EnterPhase(), modify_commandscript::HandleModifyHPCommand(), npc_commandscript::HandleNpcSetLevelCommand(), npc_pet_pri_lightwell::InitializeAI(), Player::InitStatsForLevel(), boss_skeram::JustSummoned(), npc_corrupted_totem::npc_corrupted_totem(), npc_xt002_life_spark::npc_xt002_life_sparkAI::npc_xt002_life_sparkAI(), Creature::SelectLevel(), boss_akilzon::boss_akilzonAI::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), Creature::UpdateMaxHealth(), Guardian::UpdateMaxHealth(), and Player::UpdateMaxHealth().

◆ SetMaxPower()

void Unit::SetMaxPower ( Powers  power,
uint32  val 
)
15519{
15520 uint32 cur_power = GetPower(power);
15521 SetStatInt32Value(static_cast<uint16>(UNIT_FIELD_MAXPOWER1) + power, val);
15522
15523 // group update
15524 if (GetTypeId() == TYPEID_PLAYER)
15525 {
15526 Player* player = ToPlayer();
15527 if (getPowerType() == power && player->NeedSendSpectatorData())
15528 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "MPW", power == POWER_RAGE || power == POWER_RUNIC_POWER ? val / 10 : val);
15529
15530 if (player->GetGroup())
15532 }
15533 else if (Pet* pet = ToCreature()->ToPet())
15534 {
15535 if (pet->isControlled())
15536 {
15537 Unit* owner = GetOwner();
15538 if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && owner->ToPlayer()->GetGroup())
15540 }
15541 }
15542
15543 if (val < cur_power)
15544 SetPower(power, val);
15545}
@ GROUP_UPDATE_FLAG_PET_MAX_POWER
Definition: Group.h:116
@ GROUP_UPDATE_FLAG_MAX_POWER
Definition: Group.h:104
void SetStatInt32Value(uint16 index, int32 value)
Definition: Object.cpp:798

References WorldObject::FindMap(), Player::GetGroup(), Object::GetGUID(), GetOwner(), GetPower(), getPowerType(), Object::GetTypeId(), GROUP_UPDATE_FLAG_MAX_POWER, GROUP_UPDATE_FLAG_PET_MAX_POWER, Player::NeedSendSpectatorData(), POWER_RAGE, POWER_RUNIC_POWER, ArenaSpectator::SendCommand_UInt32Value(), Player::SetGroupUpdateFlag(), SetPower(), Object::SetStatInt32Value(), Object::ToCreature(), ToPet(), Object::ToPlayer(), TYPEID_PLAYER, and UNIT_FIELD_MAXPOWER1.

Referenced by Player::Create(), Pet::CreateBaseAtTamed(), modify_commandscript::HandleModifyEnergyCommand(), modify_commandscript::HandleModifyManaCommand(), modify_commandscript::HandleModifyRageCommand(), modify_commandscript::HandleModifyRunicPowerCommand(), spell_putricide_mutated_transformation::spell_putricide_mutated_transformation_SpellScript::HandleSummon(), Player::InitStatsForLevel(), Pet::LoadPetFromDB(), npcs_ashyen_and_keleth::OnGossipSelect(), Creature::SelectLevel(), setPowerType(), Creature::UpdateMaxPower(), Guardian::UpdateMaxPower(), and Player::UpdateMaxPower().

◆ SetMinion()

void Unit::SetMinion ( Minion minion,
bool  apply 
)
10641{
10642 LOG_DEBUG("entities.unit", "SetMinion {} for {}, apply {}", minion->GetEntry(), GetEntry(), apply);
10643
10644 if (apply)
10645 {
10646 if (minion->GetOwnerGUID())
10647 {
10648 LOG_FATAL("entities.unit", "SetMinion: Minion {} is not the minion of owner {}", minion->GetEntry(), GetEntry());
10649 return;
10650 }
10651
10652 minion->SetOwnerGUID(GetGUID());
10653
10654 m_Controlled.insert(minion);
10655
10656 if (GetTypeId() == TYPEID_PLAYER)
10657 {
10658 minion->m_ControlledByPlayer = true;
10660 }
10661
10662 // Can only have one pet. If a new one is summoned, dismiss the old one.
10663 if (minion->IsGuardianPet())
10664 {
10665 if (Guardian* oldPet = GetGuardianPet())
10666 {
10667 if (oldPet != minion && (oldPet->IsPet() || minion->IsPet() || oldPet->GetEntry() != minion->GetEntry()))
10668 {
10669 // remove existing minion pet
10670 if (Pet* oldPetAsPet = oldPet->ToPet())
10671 {
10672 oldPetAsPet->Remove(PET_SAVE_NOT_IN_SLOT);
10673 }
10674 else
10675 {
10676 oldPet->UnSummon();
10677 }
10678
10679 SetPetGUID(minion->GetGUID());
10681 }
10682 }
10683 else
10684 {
10685 SetPetGUID(minion->GetGUID());
10687 }
10688 }
10689
10691 {
10693 }
10694
10695 if (minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET)
10696 {
10697 SetCritterGUID(minion->GetGUID());
10698 }
10699
10700 // PvP, FFAPvP
10702
10703 // FIXME: hack, speed must be set only at follow
10704 if (GetTypeId() == TYPEID_PLAYER && minion->IsPet())
10705 for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
10706 minion->SetSpeed(UnitMoveType(i), m_speed_rate[i], true);
10707
10708 // Ghoul pets have energy instead of mana (is anywhere better place for this code?)
10709 if (minion->IsPetGhoul() || minion->GetEntry() == 24207 /*ENTRY_ARMY_OF_THE_DEAD*/)
10710 minion->setPowerType(POWER_ENERGY);
10711
10712 if (GetTypeId() == TYPEID_PLAYER)
10713 {
10714 // Send infinity cooldown - client does that automatically but after relog cooldown needs to be set again
10715 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL));
10716
10717 if (spellInfo && spellInfo->IsCooldownStartedOnEvent())
10718 ToPlayer()->AddSpellAndCategoryCooldowns(spellInfo, 0, nullptr, true);
10719 }
10720 }
10721 else
10722 {
10723 if (minion->GetOwnerGUID() != GetGUID())
10724 {
10725 LOG_FATAL("entities.unit", "SetMinion: Minion {} is not the minion of owner {}", minion->GetEntry(), GetEntry());
10726 return;
10727 }
10728
10729 m_Controlled.erase(minion);
10730
10731 if (minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET)
10732 {
10733 if (GetCritterGUID() == minion->GetGUID())
10735 }
10736
10737 if (minion->IsGuardianPet())
10738 {
10739 if (GetPetGUID() == minion->GetGUID())
10741 }
10742 else if (minion->IsTotem())
10743 {
10744 // All summoned by totem minions must disappear when it is removed.
10745 if (SpellInfo const* spInfo = sSpellMgr->GetSpellInfo(minion->ToTotem()->GetSpell()))
10746 {
10747 for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
10748 {
10749 if (spInfo->Effects[i].Effect != SPELL_EFFECT_SUMMON)
10750 continue;
10751
10752 RemoveAllMinionsByEntry(spInfo->Effects[i].MiscValue);
10753 }
10754 }
10755 }
10756
10757 if (GetTypeId() == TYPEID_PLAYER)
10758 {
10759 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL));
10760 // Remove infinity cooldown
10761 if (spellInfo && spellInfo->IsCooldownStartedOnEvent())
10762 ToPlayer()->SendCooldownEvent(spellInfo);
10763
10764 // xinef: clear spell book
10765 if (m_Controlled.empty())
10767 }
10768
10769 //if (minion->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
10770 {
10772 {
10773 // Check if there is another minion
10774 for (ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
10775 {
10776 // do not use this check, creature do not have charm guid
10777 //if (GetCharmGUID() == (*itr)->GetGUID())
10778 if (GetGUID() == (*itr)->GetCharmerGUID())
10779 continue;
10780
10781 //ASSERT((*itr)->GetOwnerGUID() == GetGUID());
10782 if ((*itr)->GetOwnerGUID() != GetGUID())
10783 {
10784 OutDebugInfo();
10785 (*itr)->OutDebugInfo();
10786 ABORT();
10787 }
10788 ASSERT((*itr)->GetTypeId() == TYPEID_UNIT);
10789
10790 if (!(*itr)->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
10791 continue;
10792
10793 if (AddGuidValue(UNIT_FIELD_SUMMON, (*itr)->GetGUID()))
10794 {
10795 // show another pet bar if there is no charm bar
10796 if (GetTypeId() == TYPEID_PLAYER && !GetCharmGUID())
10797 {
10798 if ((*itr)->IsPet())
10800 else
10802 }
10803 }
10804 break;
10805 }
10806 }
10807 }
10808 }
10809}
@ PET_SAVE_NOT_IN_SLOT
Definition: PetDefines.h:45
UnitMoveType
Definition: Unit.h:377
@ SPELL_EFFECT_SUMMON
Definition: SharedDefines.h:778
@ SUMMON_TYPE_MINIPET
Definition: SharedDefines.h:3271
const SummonPropertiesEntry *const m_Properties
Definition: TemporarySummon.h:63
bool IsGuardianPet() const
Definition: TemporarySummon.cpp:391
bool IsPetGhoul() const
Definition: TemporarySummon.h:84
void PetSpellInitialize()
Definition: Player.cpp:9347
uint32 GetSpell(uint8 slot=0) const
Definition: Totem.h:51
void OutDebugInfo() const
Definition: Unit.cpp:20359
ObjectGuid GetCritterGUID() const
Definition: Unit.h:1826
void SetOwnerGUID(ObjectGuid owner)
Definition: Unit.cpp:10533
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition: Unit.cpp:14318
void SetCritterGUID(ObjectGuid guid)
Definition: Unit.h:1825
void setPowerType(Powers power)
Definition: Unit.cpp:9952
void RemoveAllMinionsByEntry(uint32 entry)
Definition: Unit.cpp:10823
uint32 Type
Definition: DBCStructure.h:1875

References ABORT, Object::AddGuidValue(), Player::AddSpellAndCategoryCooldowns(), ASSERT, Player::CharmSpellInitialize(), ObjectGuid::Empty, Object::GetByteValue(), GetCharmGUID(), GetCritterGUID(), Object::GetEntry(), GetGuardianPet(), Object::GetGUID(), GetOwnerGUID(), GetPetGUID(), Totem::GetSpell(), Object::GetTypeId(), Object::GetUInt32Value(), HasUnitTypeMask(), SpellInfo::IsCooldownStartedOnEvent(), Minion::IsGuardianPet(), IsPet(), Minion::IsPetGhoul(), IsTotem(), LOG_DEBUG, LOG_FATAL, m_Controlled, m_ControlledByPlayer, TempSummon::m_Properties, m_speed_rate, MAX_MOVE_TYPE, MAX_SPELL_EFFECTS, OutDebugInfo(), PET_SAVE_NOT_IN_SLOT, Player::PetSpellInitialize(), POWER_ENERGY, RemoveAllMinionsByEntry(), Object::RemoveGuidValue(), Player::SendCooldownEvent(), Player::SendRemoveControlBar(), Object::SetByteValue(), SetCritterGUID(), SetMinionGUID(), SetOwnerGUID(), SetPetGUID(), setPowerType(), SetSpeed(), SetUnitFlag(), SPELL_EFFECT_SUMMON, sSpellMgr, SUMMON_TYPE_MINIPET, ToPet(), Object::ToPlayer(), ToTotem(), SummonPropertiesEntry::Type, TYPEID_PLAYER, TYPEID_UNIT, UNIT_CREATED_BY_SPELL, UNIT_FIELD_BYTES_2, UNIT_FIELD_SUMMON, UNIT_FLAG_PLAYER_CONTROLLED, and UNIT_MASK_CONTROLABLE_GUARDIAN.

Referenced by Player::CreatePet(), Spell::EffectCreateTamedPet(), Spell::EffectTameCreature(), Pet::LoadPetFromDB(), Player::RemovePet(), and Player::SummonPet().

◆ SetMinionGUID()

void Unit::SetMinionGUID ( ObjectGuid  guid)
inline

◆ SetModelVisible()

◆ SetModifierValue()

◆ SetNativeDisplayId()

◆ SetNpcFlag()

void Unit::SetNpcFlag ( NPCFlags  flags)
inline
1647{ SetFlag(UNIT_NPC_FLAGS, flags); }

References Object::SetFlag(), and UNIT_NPC_FLAGS.

Referenced by npc_riggle_bassbait::npc_riggle_bassbaitAI::CheckTournamentState(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), boss_vaelastrasz::boss_vaelAI::Initialize(), boss_majordomo::boss_majordomoAI::InitializeAI(), npc_shay_leafrunner::npc_shay_leafrunnerAI::InitializeAI(), npc_sergeant_bly::npc_sergeant_blyAI::InitializeAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::InitializeAI(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::JustDied(), socrethar::socretharAI::JustDied(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::JustReachedHome(), npc_tirion_fordring_tft::npc_tirion_fordringAI::JustReachedHome(), npc_fairbanks::npc_fairbanksAI::MoveInLineOfSight(), npc_fos_leader_second::npc_fos_leader_secondAI::MovementInform(), npc_pos_leader_second::npc_pos_leader_secondAI::MovementInform(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::MovementInform(), npc_oculus_drakegiver::npc_oculus_drakegiverAI::MovementInform(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), npc_chicken_cluck::npc_chicken_cluckAI::ReceiveEmote(), npc_plucky::npc_pluckyAI::ReceiveEmote(), Vehicle::RemovePassenger(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::ReorderInstance(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_apothecary_hummel::boss_apothecary_hummelAI::Reset(), npc_varian_wrynn::npc_varian_wrynnAI::Reset(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), boss_azuregos::boss_azuregosAI::Reset(), hyjalAI::Reset(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::Reset(), npc_belnistrasz::npc_belnistraszAI::Reset(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::Reset(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::Reset(), npc_thassarian2::npc_thassarian2AI::Reset(), npc_crusade_recruit::npc_crusade_recruitAI::Reset(), npc_akama_illidan::npc_akama_illidanAI::Reset(), npc_akama_shade::npc_akamaAI::Reset(), Vehicle::Reset(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::ResetData(), NPCStaveQuestAI::ResetState(), boss_majordomo::boss_majordomoAI::SpellHit(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::SpellHit(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_harrison_jones::npc_harrison_jonesAI::UpdateAI(), hyjalAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_xerestrasza::npc_xerestraszaAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::UpdateAI(), npc_oculus_drakegiver::npc_oculus_drakegiverAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_shandy_dalaran::npc_shandy_dalaranAI::UpdateAI(), npc_lake_frog::npc_lake_frogAI::UpdateAI(), npc_aeranas::npc_aeranasAI::UpdateAI(), npc_arthas::npc_arthasAI::WaypointReached(), npc_daphne_stilwell::npc_daphne_stilwellAI::WaypointReached(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), npc_general_andorov::WaypointReached(), and npc_cork_gizelton::npc_cork_gizeltonAI::WaypointReached().

◆ SetOwnerGUID()

void Unit::SetOwnerGUID ( ObjectGuid  owner)
10534{
10535 if (GetOwnerGUID() == owner)
10536 return;
10537
10539 if (!owner)
10540 return;
10541
10542 m_applyResilience = !IsVehicle() && owner.IsPlayer();
10543
10544 // Update owner dependent fields
10545 Player* player = ObjectAccessor::GetPlayer(*this, owner);
10546 if (!player || !player->HaveAtClient(this)) // if player cannot see this unit yet, he will receive needed data with create object
10547 return;
10548
10550
10551 UpdateData udata;
10552 WorldPacket packet;
10553 BuildValuesUpdateBlockForPlayer(&udata, player);
10554 udata.BuildPacket(&packet);
10555 player->SendDirectMessage(&packet);
10556
10558}
void RemoveFieldNotifyFlag(uint16 flag)
Definition: Object.h:189
void BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) const
Definition: Object.cpp:257
void SetFieldNotifyFlag(uint16 flag)
Definition: Object.h:188
Definition: UpdateData.h:52
bool BuildPacket(WorldPacket *packet)
Definition: UpdateData.cpp:105
bool HaveAtClient(WorldObject const *u) const
Definition: Player.cpp:11302

References UpdateData::BuildPacket(), Object::BuildValuesUpdateBlockForPlayer(), GetOwnerGUID(), ObjectAccessor::GetPlayer(), Player::HaveAtClient(), ObjectGuid::IsPlayer(), IsVehicle(), m_applyResilience, Object::RemoveFieldNotifyFlag(), Player::SendDirectMessage(), Object::SetFieldNotifyFlag(), Object::SetGuidValue(), UF_FLAG_OWNER, and UNIT_FIELD_SUMMONEDBY.

Referenced by GameObject::CastSpell(), Spell::EffectSummonType(), boss_illidari_council_memberAI::EnterEvadeMode(), spell_item_draenic_pale_ale::HandleSummon(), npc_pet_gen_fetch_ball::IsSummonedBy(), boss_razorgore::boss_razorgoreAI::JustSummoned(), Player::LoadFromDB(), SetMinion(), and npc_grimstone::npc_grimstoneAI::UpdateEscortAI().

◆ SetPetGUID()

◆ SetPhaseMask()

void Unit::SetPhaseMask ( uint32  newPhaseMask,
bool  update 
)
overridevirtual

Reimplemented from WorldObject.

19188{
19189 if (newPhaseMask == GetPhaseMask())
19190 return;
19191
19192 if (IsInWorld())
19193 {
19194 // xinef: to comment, bellow line should be removed
19195 // pussywizard: goign to other phase (valithria, algalon) should not remove such auras
19196 //RemoveNotOwnSingleTargetAuras(newPhaseMask, true); // we can lost access to caster or target
19197
19198 if (!sScriptMgr->CanSetPhaseMask(this, newPhaseMask, update))
19199 return;
19200
19201 // modify hostile references for new phasemask, some special cases deal with hostile references themselves
19202 if (GetTypeId() == TYPEID_UNIT || (!ToPlayer()->IsGameMaster() && !ToPlayer()->GetSession()->PlayerLogout()))
19203 {
19204 HostileRefMgr& refMgr = getHostileRefMgr();
19205 HostileReference* ref = refMgr.getFirst();
19206
19207 while (ref)
19208 {
19209 if (Unit* unit = ref->GetSource()->GetOwner())
19210 if (Creature* creature = unit->ToCreature())
19211 refMgr.setOnlineOfflineState(creature, creature->InSamePhase(newPhaseMask));
19212
19213 ref = ref->next();
19214 }
19215
19216 // modify threat lists for new phasemask
19217 if (GetTypeId() != TYPEID_PLAYER)
19218 {
19221
19222 // merge expects sorted lists
19223 threatList.sort();
19224 offlineThreatList.sort();
19225 threatList.merge(offlineThreatList);
19226
19227 for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
19228 if (Unit* unit = (*itr)->getTarget())
19229 unit->getHostileRefMgr().setOnlineOfflineState(ToCreature(), unit->InSamePhase(newPhaseMask));
19230 }
19231 }
19232 }
19233
19234 WorldObject::SetPhaseMask(newPhaseMask, false);
19235
19236 if (!IsInWorld())
19237 {
19238 return;
19239 }
19240
19241 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); )
19242 {
19243 Unit* controlled = *itr;
19244 ++itr;
19245 if (controlled->GetTypeId() == TYPEID_UNIT)
19246 {
19247 controlled->SetPhaseMask(newPhaseMask, true);
19248 }
19249 }
19250
19251 for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
19252 {
19253 if (m_SummonSlot[i])
19254 {
19255 if (Creature* summon = GetMap()->GetCreature(m_SummonSlot[i]))
19256 {
19257 summon->SetPhaseMask(newPhaseMask, true);
19258 }
19259 }
19260 }
19261
19262 if (update)
19263 {
19265 }
19266}
FROM * GetSource() const
Definition: Reference.h:97
Definition: HostileRefMgr.h:32
void setOnlineOfflineState(bool isOnline)
Definition: HostileRefMgr.cpp:98
HostileReference * getFirst()
Definition: HostileRefMgr.h:60
HostileReference * next()
Definition: ThreatMgr.h:116
ThreatContainer::StorageType const & GetOfflineThreatList() const
Definition: ThreatMgr.h:275
Unit * GetOwner() const
Definition: ThreatMgr.h:237
virtual void SetPhaseMask(uint32 newPhaseMask, bool update)
Definition: Object.cpp:2836
uint32 GetPhaseMask() const
Definition: Object.h:434
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition: Unit.cpp:19187

References HostileRefMgr::getFirst(), getHostileRefMgr(), WorldObject::GetMap(), ThreatMgr::GetOfflineThreatList(), ThreatMgr::GetOwner(), WorldObject::GetPhaseMask(), Reference< TO, FROM >::GetSource(), ThreatMgr::GetThreatList(), GetThreatMgr(), Object::GetTypeId(), WorldObject::InSamePhase(), Object::IsInWorld(), m_Controlled, m_SummonSlot, MAX_SUMMON_SLOT, HostileReference::next(), HostileRefMgr::setOnlineOfflineState(), WorldObject::SetPhaseMask(), SetPhaseMask(), sScriptMgr, Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, and UpdateObjectVisibility().

Referenced by Pet::Create(), Creature::Create(), misc_commandscript::HandleAppearCommand(), modify_commandscript::HandleModifyPhaseCommand(), npc_commandscript::HandleNpcSetPhaseCommand(), spell_wintergrasp_hide_small_elementals::spell_wintergrasp_hide_small_elementals_AuraScript::HandlePeriodicDummy(), AuraEffect::HandlePhase(), Battlefield::HideNpc(), boss_volazj::InitializeAI(), boss_zuramat::boss_zuramatAI::JustSummoned(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::JustSummoned(), BattlegroundAB::RemovePlayer(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_twilight_halion::boss_twilight_halionAI::Reset(), Creature::setDeathState(), Player::SetGameMaster(), SetPhaseMask(), Battlefield::ShowNpc(), WorldObject::SummonTrigger(), and npc_mootoo_the_younger::npc_mootoo_the_youngerAI::WaypointReached().

◆ SetPower()

void Unit::SetPower ( Powers  power,
uint32  val,
bool  withPowerUpdate = true,
bool  fromRegenerate = false 
)
15454{
15455 if (!fromRegenerate && GetPower(power) == val)
15456 {
15457 return;
15458 }
15459
15460 uint32 maxPower = GetMaxPower(power);
15461 if (maxPower < val)
15462 {
15463 val = maxPower;
15464 }
15465
15466 if (fromRegenerate)
15467 {
15468 UpdateUInt32Value(static_cast<uint16>(UNIT_FIELD_POWER1) + power, val);
15470 }
15471 else
15472 {
15473 SetStatInt32Value(static_cast<uint16>(UNIT_FIELD_POWER1) + power, val);
15474 }
15475
15476 if (withPowerUpdate)
15477 {
15479 data << GetPackGUID();
15480 data << uint8(power);
15481 data << uint32(val);
15483 }
15484
15485 // group update
15486 if (GetTypeId() == TYPEID_PLAYER)
15487 {
15488 Player* player = ToPlayer();
15489 if (getPowerType() == power && player->NeedSendSpectatorData())
15490 {
15491 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "CPW", power == POWER_RAGE || power == POWER_RUNIC_POWER ? val / 10 : val);
15492 }
15493
15494 if (player->GetGroup())
15495 {
15497 }
15498 }
15499 else if (Pet* pet = ToCreature()->ToPet())
15500 {
15501 if (pet->isControlled())
15502 {
15503 Unit* owner = GetOwner();
15504 if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && owner->ToPlayer()->GetGroup())
15505 {
15507 }
15508 }
15509
15510 // Update the pet's character sheet with happiness damage bonus
15511 if (pet->getPetType() == HUNTER_PET && power == POWER_HAPPINESS)
15512 {
15513 pet->UpdateDamagePhysical(BASE_ATTACK);
15514 }
15515 }
15516}
@ GROUP_UPDATE_FLAG_PET_CUR_POWER
Definition: Group.h:115
@ GROUP_UPDATE_FLAG_CUR_POWER
Definition: Group.h:103
@ SMSG_POWER_UPDATE
Definition: Opcodes.h:1182
void UpdateUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:663
void AddToObjectUpdateIfNeeded()
Definition: Object.cpp:524

References Object::AddToObjectUpdateIfNeeded(), BASE_ATTACK, WorldObject::FindMap(), Player::GetGroup(), Object::GetGUID(), GetMaxPower(), GetOwner(), Object::GetPackGUID(), GetPower(), getPowerType(), Object::GetTypeId(), GROUP_UPDATE_FLAG_CUR_POWER, GROUP_UPDATE_FLAG_PET_CUR_POWER, HUNTER_PET, Player::NeedSendSpectatorData(), POWER_HAPPINESS, POWER_RAGE, POWER_RUNIC_POWER, ArenaSpectator::SendCommand_UInt32Value(), WorldObject::SendMessageToSet(), Player::SetGroupUpdateFlag(), Object::SetStatInt32Value(), SMSG_POWER_UPDATE, Object::ToCreature(), ToPet(), Object::ToPlayer(), TYPEID_PLAYER, UNIT_FIELD_POWER1, and Object::UpdateUInt32Value().

Referenced by Player::ActivateSpec(), Player::Create(), Pet::CreateBaseAtTamed(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::DoAction(), Spell::EffectSelfResurrect(), Spell::EffectSummonPet(), Player::GiveLevel(), AuraEffect::HandleAuraModShapeshift(), spell_warr_execute::HandleEffect(), modify_commandscript::HandleModifyEnergyCommand(), modify_commandscript::HandleModifyManaCommand(), modify_commandscript::HandleModifyRageCommand(), modify_commandscript::HandleModifyRunicPowerCommand(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), AuraEffect::HandlePeriodicDummyAuraTick(), WorldSession::HandlePetAbandon(), spell_gen_pet_summoned::HandleScript(), spell_putricide_mutated_transformation::spell_putricide_mutated_transformation_SpellScript::HandleSummon(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), Creature::LoadCreatureFromDB(), Player::LoadFromDB(), Pet::LoadPetFromDB(), ModifyPower(), npcs_ashyen_and_keleth::OnGossipSelect(), Player::ProcessDelayedOperations(), Player::Regenerate(), spell_igb_incinerating_blast::spell_igb_incinerating_blast_SpellScript::RemoveEnergy(), spell_igb_below_zero::spell_igb_below_zero_SpellScript::RemovePassengers(), boss_selin_fireheart::boss_selin_fireheartAI::Reset(), boss_moam::Reset(), npc_obsidian_destroyer::Reset(), npc_obsidian_eradicator::Reset(), npc_obsidian_nullifier::Reset(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::Reset(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::Reset(), Player::ResetAllPowers(), Player::RestoreManaAfterDuel(), Player::ResurectUsingRequestData(), Player::ResurrectPlayer(), Creature::SelectLevel(), setDeathState(), SetMaxPower(), setPowerType(), Player::SummonPet(), boss_shade_of_aran::boss_aranAI::UpdateAI(), and npc_dalaran_mage::npc_dalaran_mageAI::UpdateAI().

◆ setPowerType()

void Unit::setPowerType ( Powers  power)
9953{
9954 SetByteValue(UNIT_FIELD_BYTES_0, 3, new_powertype);
9955
9956 if (GetTypeId() == TYPEID_PLAYER)
9957 {
9958 if (ToPlayer()->GetGroup())
9960 }
9961 else if (Pet* pet = ToCreature()->ToPet())
9962 {
9963 if (pet->isControlled())
9964 {
9965 Unit* owner = GetOwner();
9966 if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && owner->ToPlayer()->GetGroup())
9968 }
9969 }
9970
9971 float powerMultiplier = 1.0f;
9972 if (!IsPet())
9973 if (Creature* creature = ToCreature())
9974 powerMultiplier = creature->GetCreatureTemplate()->ModMana;
9975
9976 switch (new_powertype)
9977 {
9978 default:
9979 case POWER_MANA:
9980 break;
9981 case POWER_RAGE:
9982 SetMaxPower(POWER_RAGE, uint32(std::ceil(GetCreatePowers(POWER_RAGE) * powerMultiplier)));
9983 SetPower(POWER_RAGE, 0);
9984 break;
9985 case POWER_FOCUS:
9986 SetMaxPower(POWER_FOCUS, uint32(std::ceil(GetCreatePowers(POWER_FOCUS) * powerMultiplier)));
9987 SetPower(POWER_FOCUS, uint32(std::ceil(GetCreatePowers(POWER_FOCUS) * powerMultiplier)));
9988 break;
9989 case POWER_ENERGY:
9990 SetMaxPower(POWER_ENERGY, uint32(std::ceil(GetCreatePowers(POWER_ENERGY) * powerMultiplier)));
9991 break;
9992 case POWER_HAPPINESS:
9993 SetMaxPower(POWER_HAPPINESS, uint32(std::ceil(GetCreatePowers(POWER_HAPPINESS) * powerMultiplier)));
9994 SetPower(POWER_HAPPINESS, uint32(std::ceil(GetCreatePowers(POWER_HAPPINESS) * powerMultiplier)));
9995 break;
9996 }
9997
9998 if (Player const* player = ToPlayer())
9999 if (player->NeedSendSpectatorData())
10000 {
10001 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "PWT", new_powertype);
10002 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "MPW", new_powertype == POWER_RAGE || new_powertype == POWER_RUNIC_POWER ? GetMaxPower(new_powertype) / 10 : GetMaxPower(new_powertype));
10003 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "CPW", new_powertype == POWER_RAGE || new_powertype == POWER_RUNIC_POWER ? GetPower(new_powertype) / 10 : GetPower(new_powertype));
10004 }
10005}
@ GROUP_UPDATE_FLAG_POWER_TYPE
Definition: Group.h:102
@ GROUP_UPDATE_FLAG_PET_POWER_TYPE
Definition: Group.h:114
void SetMaxPower(Powers power, uint32 val)
Definition: Unit.cpp:15518

References WorldObject::FindMap(), GetCreatePowers(), Player::GetGroup(), Object::GetGUID(), GetMaxPower(), GetOwner(), GetPower(), Object::GetTypeId(), GROUP_UPDATE_FLAG_PET_POWER_TYPE, GROUP_UPDATE_FLAG_POWER_TYPE, IsPet(), POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_MANA, POWER_RAGE, POWER_RUNIC_POWER, ArenaSpectator::SendCommand_UInt32Value(), Object::SetByteValue(), Player::SetGroupUpdateFlag(), SetMaxPower(), SetPower(), Object::ToCreature(), ToPet(), Object::ToPlayer(), TYPEID_PLAYER, and UNIT_FIELD_BYTES_0.

Referenced by Pet::CreateBaseAtTamed(), AuraEffect::HandleAuraModShapeshift(), spell_putricide_mutated_transformation::spell_putricide_mutated_transformation_SpellScript::HandleSummon(), Player::InitDataForForm(), Vehicle::Install(), Pet::LoadPetFromDB(), npc_toc_rogue::npc_toc_rogueAI::npc_toc_rogueAI(), npcs_ashyen_and_keleth::OnGossipSelect(), SetMinion(), and Player::SummonPet().

◆ SetPvP()

void Unit::SetPvP ( bool  state)
inline

◆ setRace()

void Unit::setRace ( uint8  race)
21157{
21158 if (GetTypeId() == TYPEID_PLAYER)
21159 m_race = race;
21160}

References Object::GetTypeId(), m_race, and TYPEID_PLAYER.

◆ SetRedirectThreat()

void Unit::SetRedirectThreat ( ObjectGuid  guid,
uint32  pct 
)
inline
2344{ _redirectThreatInfo.Set(guid, pct); }
void Set(ObjectGuid guid, uint32 pct)
Definition: Unit.h:956

References _redirectThreatInfo, and RedirectThreatInfo::Set().

Referenced by Spell::EffectRedirectThreat(), and ResetRedirectThreat().

◆ SetResistance()

void Unit::SetResistance ( SpellSchools  school,
int32  val 
)
inline

◆ SetResistanceBuffMods()

void Unit::SetResistanceBuffMods ( SpellSchools  school,
bool  positive,
float  val 
)
inline

◆ SetRooted()

void Unit::SetRooted ( bool  apply,
bool  isStun = false 
)
protected
18336{
18337 if (apply)
18338 {
18339 if (m_rootTimes > 0) // blizzard internal check?
18340 m_rootTimes++;
18341
18342 // MOVEMENTFLAG_ROOT cannot be used in conjunction with MOVEMENTFLAG_MASK_MOVING (tested 3.3.5a)
18343 // this will freeze clients. That's why we remove MOVEMENTFLAG_MASK_MOVING before
18344 // setting MOVEMENTFLAG_ROOT
18346
18347 if (IsFalling())
18348 {
18350 }
18351 else
18352 {
18354 }
18355
18356 // Creature specific
18357 if (GetTypeId() != TYPEID_PLAYER)
18358 {
18359 if (isStun && movespline->Finalized())
18360 {
18362 }
18363 else
18364 {
18365 StopMoving();
18366 }
18367 }
18368
18369 if (m_movedByPlayer)
18370 {
18371 WorldPacket data(SMSG_FORCE_MOVE_ROOT, GetPackGUID().size() + 4);
18372 data << GetPackGUID();
18373 data << m_rootTimes;
18375 }
18376 else
18377 {
18379 data << GetPackGUID();
18380 SendMessageToSet(&data, true);
18381 }
18382 }
18383 else
18384 {
18386
18387 if (!HasUnitState(UNIT_STATE_STUNNED)) // prevent moving if it also has stun effect
18388 {
18389 if (m_movedByPlayer)
18390 {
18392 data << GetPackGUID();
18393 data << m_rootTimes;
18395 }
18396 else
18397 {
18399 data << GetPackGUID();
18400 SendMessageToSet(&data, true);
18401 }
18402 }
18403 }
18404}
@ MOVEMENTFLAG_PENDING_ROOT
Definition: Unit.h:572
@ SMSG_FORCE_MOVE_UNROOT
Definition: Opcodes.h:264
@ SMSG_FORCE_MOVE_ROOT
Definition: Opcodes.h:262
@ SMSG_SPLINE_MOVE_ROOT
Definition: Opcodes.h:824
void StopMovingOnCurrentPos()
Definition: Unit.cpp:16837

References AddUnitMovementFlag(), Movement::MoveSpline::Finalized(), Object::GetPackGUID(), Object::GetTypeId(), HasUnitState(), IsFalling(), m_movedByPlayer, m_rootTimes, MOVEMENTFLAG_MASK_MOVING, MOVEMENTFLAG_PENDING_ROOT, MOVEMENTFLAG_ROOT, movespline, RemoveUnitMovementFlag(), Player::SendDirectMessage(), WorldObject::SendMessageToSet(), SMSG_FORCE_MOVE_ROOT, SMSG_FORCE_MOVE_UNROOT, SMSG_SPLINE_MOVE_ROOT, SMSG_SPLINE_MOVE_UNROOT, StopMoving(), StopMovingOnCurrentPos(), Object::ToPlayer(), TYPEID_PLAYER, and UNIT_STATE_STUNNED.

Referenced by WorldSession::HandleLogoutCancelOpcode(), WorldSession::HandleLogoutRequestOpcode(), SetControlled(), and SetStunned().

◆ SetShapeshiftForm()

void Unit::SetShapeshiftForm ( ShapeshiftForm  form)
inline

◆ SetSheath()

◆ SetSpeed()

void Unit::SetSpeed ( UnitMoveType  mtype,
float  rate,
bool  forced = false 
)
14319{
14320 if (rate < 0)
14321 rate = 0.0f;
14322
14323 // Update speed only on change
14324 if (m_speed_rate[mtype] == rate)
14325 return;
14326
14327 m_speed_rate[mtype] = rate;
14328
14330
14331 WorldPacket data;
14332 if (!forced)
14333 {
14334 switch (mtype)
14335 {
14336 case MOVE_WALK:
14337 data.Initialize(MSG_MOVE_SET_WALK_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14338 break;
14339 case MOVE_RUN:
14340 data.Initialize(MSG_MOVE_SET_RUN_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14341 break;
14342 case MOVE_RUN_BACK:
14343 data.Initialize(MSG_MOVE_SET_RUN_BACK_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14344 break;
14345 case MOVE_SWIM:
14346 data.Initialize(MSG_MOVE_SET_SWIM_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14347 break;
14348 case MOVE_SWIM_BACK:
14349 data.Initialize(MSG_MOVE_SET_SWIM_BACK_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14350 break;
14351 case MOVE_TURN_RATE:
14352 data.Initialize(MSG_MOVE_SET_TURN_RATE, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14353 break;
14354 case MOVE_FLIGHT:
14355 data.Initialize(MSG_MOVE_SET_FLIGHT_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14356 break;
14357 case MOVE_FLIGHT_BACK:
14358 data.Initialize(MSG_MOVE_SET_FLIGHT_BACK_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14359 break;
14360 case MOVE_PITCH_RATE:
14361 data.Initialize(MSG_MOVE_SET_PITCH_RATE, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14362 break;
14363 default:
14364 LOG_ERROR("entities.unit", "Unit::SetSpeed: Unsupported move type ({}), data not sent to client.", mtype);
14365 return;
14366 }
14367
14368 data << GetPackGUID();
14369 BuildMovementPacket(&data);
14370 data << float(GetSpeed(mtype));
14371 SendMessageToSet(&data, true);
14372 }
14373 else
14374 {
14375 if (GetTypeId() == TYPEID_PLAYER)
14376 {
14377 // register forced speed changes for WorldSession::HandleForceSpeedChangeAck
14378 // and do it only for real sent packets and use run for run/mounted as client expected
14379 ++ToPlayer()->m_forced_speed_changes[mtype];
14380
14381 // Xinef: update speed of pet also
14382 if (!IsInCombat())
14383 {
14384 Unit* pet = ToPlayer()->GetPet();
14385 if (!pet)
14386 pet = GetCharm();
14387
14388 // xinef: do not affect vehicles and possesed pets
14389 if (pet && (pet->HasUnitFlag(UNIT_FLAG_POSSESSED) || pet->IsVehicle()))
14390 pet = nullptr;
14391
14393 pet->UpdateSpeed(mtype, forced);
14394 if (Unit* critter = ObjectAccessor::GetUnit(*this, GetCritterGUID()))
14395 critter->UpdateSpeed(mtype, forced);
14396 }
14397 ToPlayer()->SetCanTeleport(true);
14398 }
14399
14400 switch (mtype)
14401 {
14402 case MOVE_WALK:
14404 break;
14405 case MOVE_RUN:
14407 break;
14408 case MOVE_RUN_BACK:
14410 break;
14411 case MOVE_SWIM:
14413 break;
14414 case MOVE_SWIM_BACK:
14416 break;
14417 case MOVE_TURN_RATE:
14419 break;
14420 case MOVE_FLIGHT:
14422 break;
14423 case MOVE_FLIGHT_BACK:
14425 break;
14426 case MOVE_PITCH_RATE:
14428 break;
14429 default:
14430 LOG_ERROR("entities.unit", "Unit::SetSpeed: Unsupported move type ({}), data not sent to client.", mtype);
14431 return;
14432 }
14433 data << GetPackGUID();
14434 data << (uint32)0; // moveEvent, NUM_PMOVE_EVTS = 0x39
14435 if (mtype == MOVE_RUN)
14436 data << uint8(0); // new 2.1.0
14437 data << float(GetSpeed(mtype));
14438 SendMessageToSet(&data, true);
14439 }
14440}
@ MOVE_TURN_RATE
Definition: Unit.h:383
@ MOVE_FLIGHT_BACK
Definition: Unit.h:385
@ MOVE_SWIM_BACK
Definition: Unit.h:382
@ MOVE_PITCH_RATE
Definition: Unit.h:386
@ MOVE_RUN_BACK
Definition: Unit.h:380
@ MOVE_WALK
Definition: Unit.h:378
@ FOLLOW_MOTION_TYPE
Definition: MotionMaster.h:52
@ SMSG_FORCE_TURN_RATE_CHANGE
Definition: Opcodes.h:764
@ MSG_MOVE_SET_SWIM_BACK_SPEED
Definition: Opcodes.h:243
@ MSG_MOVE_SET_TURN_RATE
Definition: Opcodes.h:246
@ SMSG_FORCE_WALK_SPEED_CHANGE
Definition: Opcodes.h:760
@ SMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE
Definition: Opcodes.h:929
@ MSG_MOVE_SET_PITCH_RATE
Definition: Opcodes.h:1145
@ SMSG_FORCE_RUN_SPEED_CHANGE
Definition: Opcodes.h:256
@ SMSG_FORCE_SWIM_BACK_SPEED_CHANGE
Definition: Opcodes.h:762
@ SMSG_FORCE_RUN_BACK_SPEED_CHANGE
Definition: Opcodes.h:258
@ SMSG_FORCE_FLIGHT_SPEED_CHANGE
Definition: Opcodes.h:927
@ SMSG_FORCE_SWIM_SPEED_CHANGE
Definition: Opcodes.h:260
@ MSG_MOVE_SET_RUN_SPEED
Definition: Opcodes.h:235
@ MSG_MOVE_SET_FLIGHT_SPEED
Definition: Opcodes.h:924
@ MSG_MOVE_SET_WALK_SPEED
Definition: Opcodes.h:239
@ MSG_MOVE_SET_SWIM_SPEED
Definition: Opcodes.h:241
@ MSG_MOVE_SET_FLIGHT_BACK_SPEED
Definition: Opcodes.h:926
@ SMSG_FORCE_PITCH_RATE_CHANGE
Definition: Opcodes.h:1146
@ MSG_MOVE_SET_RUN_BACK_SPEED
Definition: Opcodes.h:237
uint8 m_forced_speed_changes[MAX_MOVE_TYPE]
Definition: Player.h:2350
float GetSpeed(UnitMoveType mtype) const
Definition: Unit.cpp:14313
void propagateSpeedChange()
-------—End of Pet responses methods-------—
Definition: Unit.h:2309
MovementGeneratorType GetCurrentMovementGeneratorType() const
Definition: MotionMaster.cpp:817

References BuildMovementPacket(), FOLLOW_MOTION_TYPE, GetCharm(), GetCritterGUID(), MotionMaster::GetCurrentMovementGeneratorType(), GetMotionMaster(), Object::GetPackGUID(), Player::GetPet(), GetSpeed(), Object::GetTypeId(), ObjectAccessor::GetUnit(), HasUnitFlag(), WorldPacket::Initialize(), IsInCombat(), IsVehicle(), LOG_ERROR, Player::m_forced_speed_changes, m_speed_rate, MOVE_FLIGHT, MOVE_FLIGHT_BACK, MOVE_PITCH_RATE, MOVE_RUN, MOVE_RUN_BACK, MOVE_SWIM, MOVE_SWIM_BACK, MOVE_TURN_RATE, MOVE_WALK, MSG_MOVE_SET_FLIGHT_BACK_SPEED, MSG_MOVE_SET_FLIGHT_SPEED, MSG_MOVE_SET_PITCH_RATE, MSG_MOVE_SET_RUN_BACK_SPEED, MSG_MOVE_SET_RUN_SPEED, MSG_MOVE_SET_SWIM_BACK_SPEED, MSG_MOVE_SET_SWIM_SPEED, MSG_MOVE_SET_TURN_RATE, MSG_MOVE_SET_WALK_SPEED, propagateSpeedChange(), WorldObject::SendMessageToSet(), Player::SetCanTeleport(), SMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE, SMSG_FORCE_FLIGHT_SPEED_CHANGE, SMSG_FORCE_PITCH_RATE_CHANGE, SMSG_FORCE_RUN_BACK_SPEED_CHANGE, SMSG_FORCE_RUN_SPEED_CHANGE, SMSG_FORCE_SWIM_BACK_SPEED_CHANGE, SMSG_FORCE_SWIM_SPEED_CHANGE, SMSG_FORCE_TURN_RATE_CHANGE, SMSG_FORCE_WALK_SPEED_CHANGE, Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, UNIT_FLAG_POSSESSED, and UpdateSpeed().

Referenced by Battleground::AddCreature(), boss_bug_trio::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::DoAction(), boss_sartharion_dragonAI::EnterCombat(), boss_four_horsemen::boss_four_horsemenAI::EnterCombat(), boss_zuljin::boss_zuljinAI::EnterPhase(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::FlyAway(), boss_volkhan::boss_volkhanAI::GoToAnvil(), misc_commandscript::HandleDismountCommand(), spell_mount_check::spell_mount_check_AuraScript::HandleEffectPeriodic(), boss_sartharion_tenebron::boss_sartharion_tenebronAI::HandleExtraEvent(), boss_sartharion_shadron::boss_sartharion_shadronAI::HandleExtraEvent(), boss_sartharion_vesperon::boss_sartharion_vesperonAI::HandleExtraEvent(), WorldSession::HandleForceSpeedChangeAck(), modify_commandscript::HandleModifyASpeedCommand(), modify_commandscript::HandleModifyMountCommand(), Creature::InitEntry(), boss_glob_of_viscidus::InitializeAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), boss_ichoron::boss_ichoronAI::JustSummoned(), boss_sartharion::boss_sartharionAI::JustSummoned(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::MountSelf(), boss_onyxia::MovementInform(), boss_bug_trio::MovementInform(), boss_volkhan::boss_volkhanAI::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_akilzon_eagle::npc_akilzon_eagleAI::MovementInform(), npc_hallows_end_soh::npc_hallows_end_soh(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), npc_hover_disk::npc_hover_diskAI::PassengerBoarded(), npc_eastvale_peasent::PathEndReached(), SmartScript::ProcessAction(), boss_nightbane::boss_nightbaneAI::Reset(), boss_kalec::boss_kalecAI::Reset(), boss_nalorakk::boss_nalorakkAI::Reset(), boss_headless_horseman::Reset(), boss_onyxia::Reset(), boss_bug_trio::Reset(), boss_sartharion_dragonAI::Reset(), boss_sindragosa::boss_sindragosaAI::Reset(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::Reset(), boss_volkhan::boss_volkhanAI::Reset(), boss_thorim_sif_blizzard::boss_thorim_sif_blizzardAI::Reset(), npc_wild_wyrm::npc_wild_wyrmAI::Reset(), npc_freed_protodrake::npc_freed_protodrakeAI::Reset(), npc_dream_fog::npc_dream_fogAI::ScheduleEvents(), npc_eastvale_peasent::SetData(), SetMinion(), Battlefield::SpawnCreature(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UnMountSelf(), npc_akilzon_eagle::npc_akilzon_eagleAI::UpdateAI(), boss_zuljin::boss_zuljinAI::UpdateAI(), boss_onyxia::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), boss_yoggsaron_death_orb::boss_yoggsaron_death_orbAI::UpdateAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), npc_ulduar_mimiron_rocket::npc_ulduar_mimiron_rocketAI::UpdateAI(), and UpdateSpeed().

◆ SetSpeedRate()

◆ SetStandFlags()

◆ SetStandState()

void Unit::SetStandState ( uint8  state)
16875{
16877
16878 if (IsStandState())
16880
16881 if (GetTypeId() == TYPEID_PLAYER)
16882 {
16884 data << (uint8)state;
16885 ToPlayer()->GetSession()->SendPacket(&data);
16886 }
16887}
@ UNIT_BYTES_1_OFFSET_STAND_STATE
Definition: Unit.h:44
@ SMSG_STANDSTATE_UPDATE
Definition: Opcodes.h:699

References AURA_INTERRUPT_FLAG_NOT_SEATED, Player::GetSession(), Object::GetTypeId(), IsStandState(), RemoveAurasWithInterruptFlags(), WorldSession::SendPacket(), Object::SetByteValue(), SMSG_STANDSTATE_UPDATE, Object::ToPlayer(), TYPEID_PLAYER, UNIT_BYTES_1_OFFSET_STAND_STATE, and UNIT_FIELD_BYTES_1.

Referenced by _ApplyAura(), npc_mograine::npc_mograineAI::AshbringerEvent(), boss_felmyst::boss_felmystAI::boss_felmystAI(), boss_kologarn::boss_kologarnAI::boss_kologarnAI(), boss_twinemperorsAI::boss_twinemperorsAI(), boss_thekal::boss_thekalAI::CheckPhaseTransition(), npc_ringo::npc_ringoAI::ClearFaint(), npc_kerlonian::npc_kerlonianAI::ClearSleeping(), CombatStart(), boss_thekal::boss_thekalAI::DamageTaken(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::DamageTaken(), boss_twinemperorsAI::DoAction(), npc_twilight_volunteer::DoAction(), npc_madrigosa::npc_madrigosaAI::DoAction(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::DoAction(), boss_the_lurker_below::boss_the_lurker_belowAI::DoAction(), npc_taretha::npc_tarethaAI::DoAction(), Spell::DoAllEffectOnTarget(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), boss_kalecgos::boss_kalecgosAI::EnterCombat(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::EnterCombat(), UtherBatteredHiltEvent::Execute(), SuckBackEvent::Execute(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::FeignDeath(), WorldSession::HandleAlterAppearance(), WorldSession::HandleLogoutCancelOpcode(), WorldSession::HandleLogoutRequestOpcode(), WorldSession::HandleMovementOpcodes(), WorldSession::HandlePlayerLoginFromDB(), AuraEffect::HandleSpiritOfRedemption(), WorldSession::HandleStandStateChangeOpcode(), spell_q11322_q11317_the_cleansing::if(), DistractMovementGenerator::Initialize(), npc_ranshalla::npc_ranshallaAI::JustDidDialogueStep(), boss_the_lich_king::boss_the_lich_kingAI::JustReachedHome(), boss_palehoof::boss_palehoofAI::JustReachedHome(), npc_massive_jormungar::npc_massive_jormungarAI::JustReachedHome(), npc_ferocious_rhino::npc_ferocious_rhinoAI::JustReachedHome(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::JustReachedHome(), npc_frenzied_worgen::npc_frenzied_worgenAI::JustReachedHome(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustRespawned(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::JustSummoned(), npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::JustSummoned(), npc_scarlet_guard::npc_scarlet_guardAI::MoveInLineOfSight(), npc_mograine::npc_mograineAI::MoveInLineOfSight(), boss_anubarak_trial::boss_anubarak_trialAI::MoveInLineOfSight(), boss_kologarn::boss_kologarnAI::MoveInLineOfSight(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::MoveInLineOfSight(), npc_twilight_volunteer::MovementInform(), boss_mr_smite::boss_mr_smiteAI::MovementInform(), kaylaan_the_lost::kaylaan_the_lostAI::MovementInform(), npc_madrigosa::npc_madrigosaAI::npc_madrigosaAI(), spell_love_is_in_the_air_romantic_picnic::OnApply(), spell_alar_ember_blast_death::spell_alar_ember_blast_death_AuraScript::OnApply(), npc_kernobee::OnQuestAccept(), npc_koltira_deathweaver::OnQuestAccept(), npc_kerlonian::OnQuestAccept(), npc_gilthares::OnQuestAccept(), npc_ringo::OnQuestAccept(), npc_maghar_captive::OnQuestAccept(), npc_mootoo_the_younger::OnQuestAccept(), npc_bonker_togglevolt::OnQuestAccept(), spell_alar_ember_blast_death::spell_alar_ember_blast_death_AuraScript::OnRemove(), Spell::prepare(), PretendToDie(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_vaelastrasz::boss_vaelAI::Reset(), boss_mr_smite::boss_mr_smiteAI::Reset(), boss_kalecgos::boss_kalecgosAI::Reset(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::Reset(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), boss_thekal::boss_thekalAI::Reset(), npc_draenei_survivor::npc_draenei_survivorAI::Reset(), npc_injured_draenei::npc_injured_draeneiAI::Reset(), npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::Reset(), boss_anubarak_trial::boss_anubarak_trialAI::Reset(), boss_professor_putricide::boss_professor_putricideAI::Reset(), boss_the_lich_king::boss_the_lich_kingAI::Reset(), npc_imprisoned_beryl_sorcerer::npc_imprisoned_beryl_sorcererAI::Reset(), npc_thassarian2::npc_thassarian2AI::Reset(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::Reset(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::Reset(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::Reset(), boss_the_lurker_below::boss_the_lurker_belowAI::Reset(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::Reset(), Resurrect(), npc_ringo::npc_ringoAI::SetFaint(), npc_kurenai_captive::npc_kurenai_captiveAI::SetGUID(), SetInCombatState(), npc_kerlonian::npc_kerlonianAI::SetSleeping(), SetStunned(), boss_victor_nefarius::boss_victor_nefariusAI::sGossipSelect(), npc_draenei_survivor::npc_draenei_survivorAI::SpellHit(), npc_wounded_skirmisher::SpellHit(), npc_wild_wyrm::npc_wild_wyrmAI::SpellHit(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::SummonedCreatureDies(), npc_commander_dawnforge::npc_commander_dawnforgeAI::Turn_to_eachother(), npc_commander_dawnforge::npc_commander_dawnforgeAI::Turn_to_Pathaleons_Image(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_shade_of_aran::boss_aranAI::UpdateAI(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_corporal_keeshan::npc_corporal_keeshanAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_forest_frog::npc_forest_frogAI::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::UpdateAI(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::UpdateAI(), boss_the_lurker_below::boss_the_lurker_belowAI::UpdateAI(), socrethar::socretharAI::UpdateAI(), npc_tallhorn_stag::npc_tallhorn_stagAI::UpdateAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), GameObject::Use(), and npc_koltira_deathweaver::npc_koltira_deathweaverAI::WaypointReached().

◆ SetStat()

◆ SetStunned()

void Unit::SetStunned ( bool  apply)
protected
18288{
18290 {
18291 return;
18292 }
18293
18294 if (apply)
18295 {
18296 SetTarget();
18298
18299 if (GetTypeId() == TYPEID_PLAYER)
18300 {
18302 }
18303
18304 SetRooted(true, true);
18305
18306 CastStop();
18307 }
18308 else
18309 {
18310 if (IsAlive() && GetVictim())
18312
18313 if (GetTypeId() == TYPEID_UNIT)
18314 {
18315 // don't remove UNIT_FLAG_STUNNED for pet when owner is mounted (disabled pet's interface)
18316 Unit* owner = GetOwner();
18317 if (!owner || owner->GetTypeId() != TYPEID_PLAYER || !owner->ToPlayer()->IsMounted())
18319
18320 // Xinef: same for charmed npcs
18321 owner = GetCharmer();
18322 if (!owner || owner->GetTypeId() != TYPEID_PLAYER || !owner->ToPlayer()->IsMounted())
18324 }
18325 else
18327
18328 if (!HasUnitState(UNIT_STATE_ROOT)) // prevent moving if it also has root effect
18329 {
18330 SetRooted(false, true);
18331 }
18332 }
18333}

References CastStop(), GetCharmer(), Object::GetGUID(), GetOwner(), Object::GetTypeId(), GetVictim(), HasUnitState(), IsAlive(), IsMounted(), RemoveUnitFlag(), SetRooted(), SetStandState(), SetTarget(), SetUnitFlag(), Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, UNIT_FLAG_STUNNED, UNIT_STAND_STATE_STAND, UNIT_STATE_IN_FLIGHT, and UNIT_STATE_ROOT.

Referenced by SetControlled().

◆ SetSwim()

bool Unit::SetSwim ( bool  enable)
virtual

◆ SetTarget()

virtual void Unit::SetTarget ( ObjectGuid  = ObjectGuid::Empty)
pure virtual

◆ setTransForm()

void Unit::setTransForm ( uint32  spellid)
inline
2173{ m_transform = spellid;}

References m_transform.

Referenced by AuraEffect::HandleAuraTransform().

◆ SetUnitFlag()

void Unit::SetUnitFlag ( UnitFlags  flags)
inline
1481{ SetFlag(UNIT_FIELD_FLAGS, flags); }

References Object::SetFlag(), and UNIT_FIELD_FLAGS.

Referenced by Vehicle::AddPassenger(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::AddPortals(), Creature::AllLootRemovedFromCorpse(), npc_doctor::npc_doctorAI::BeginEvent(), boss_ahune::boss_ahuneAI::boss_ahuneAI(), boss_jarien::boss_jarien(), boss_sothos::boss_sothos(), GameObject::CastSpell(), Player::Create(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::DamageTaken(), npc_mograine::npc_mograineAI::DamageTaken(), boss_apothecary_hummel::boss_apothecary_hummelAI::DamageTaken(), boss_kiljaeden::boss_kiljaedenAI::DamageTaken(), boss_muru::boss_muruAI::DamageTaken(), boss_jedoga_shadowseeker::DamageTaken(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_frost_sphere::npc_frost_sphereAI::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), npc_crystalline_frayer::npc_crystalline_frayerAI::DamageTaken(), boss_algalon_the_observer::boss_algalon_the_observerAI::DamageTaken(), boss_freya::boss_freyaAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::DamageTaken(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::DamageTaken(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::DamageTaken(), boss_illidan_stormrage::boss_illidan_stormrageAI::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), boss_taerar::boss_taerarAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::Deactivate(), DisableRotate(), boss_thorim::boss_thorimAI::DisableThorim(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), boss_felmyst::boss_felmystAI::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::DoAction(), npc_xt002_heart::npc_xt002_heartAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), PetAI::DoAttack(), FlightPathMovementGenerator::DoReset(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::EnableSara(), boss_algalon_the_observer::boss_algalon_the_observerAI::EnterCombat(), boss_mimiron::boss_mimironAI::EnterCombat(), boss_felmyst::boss_felmystAI::EnterCombat(), boss_novos::boss_novosAI::EnterCombat(), boss_gothik::boss_gothikAI::EnterCombat(), boss_kelthuzad::boss_kelthuzadAI::EnterCombat(), boss_cyanigosa::boss_cyanigosaAI::EnterEvadeMode(), boss_erekem::boss_erekemAI::EnterEvadeMode(), boss_ichoron::boss_ichoronAI::EnterEvadeMode(), boss_lavanthor::boss_lavanthorAI::EnterEvadeMode(), boss_moragg::boss_moraggAI::EnterEvadeMode(), boss_xevozz::boss_xevozzAI::EnterEvadeMode(), boss_zuramat::boss_zuramatAI::EnterEvadeMode(), boss_ahune::boss_ahuneAI::EnterEvadeMode(), boss_anubarak_trial::boss_anubarak_trialAI::EnterEvadeMode(), boss_jaraxxus::boss_jaraxxusAI::EnterEvadeMode(), boss_gormok::boss_gormokAI::EnterEvadeMode(), boss_jormungarAI::EnterEvadeMode(), boss_icehowl::boss_icehowlAI::EnterEvadeMode(), boss_zuljin::boss_zuljinAI::EnterPhase(), SACDeactivateEvent::Execute(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::FeignDeath(), spell_boss_magus_telestra_summon_telestra_clones::spell_boss_magus_telestra_summon_telestra_clones_AuraScript::HandleApply(), AuraEffect::HandleArenaPreparation(), AuraEffect::HandleAuraModFaction(), AuraEffect::HandleAuraModPacify(), AuraEffect::HandleAuraModSilence(), spell_q13007_iron_colossus::spell_q13007_iron_colossus_SpellScript::HandleDummy(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_gen_model_visible::HandleEffectApply(), AuraEffect::HandleFeignDeath(), BattlefieldWG::HandleKill(), Battleground::HandleKillPlayer(), WorldSession::HandleLogoutRequestOpcode(), spell_oculus_rider_aura::spell_oculus_rider_auraAuraScript::HandleOnEffectApply(), Battlefield::HideNpc(), prince_axes::prince_axesAI::Initialize(), npc_captured_beryl_sorcerer::npc_captured_beryl_sorcererAI::Initialize(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::InitializeAI(), boss_kiljaeden::boss_kiljaedenAI::InitializeAI(), npc_general_andorov::InitializeAI(), boss_sapphiron::boss_sapphironAI::InitializeAI(), Player::InitStatsForLevel(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::IsSummonedBy(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), boss_majordomo::boss_majordomoAI::JustSummoned(), boss_hazzarah::JustSummoned(), boss_illidan_stormrage::boss_illidan_stormrageAI::JustSummoned(), boss_vaelastrasz::boss_vaelAI::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), boss_archimonde::boss_archimondeAI::JustSummoned(), boss_broggok::boss_broggokAI::JustSummoned(), npc_varian_wrynn::npc_varian_wrynnAI::JustSummoned(), Mount(), npc_giant_infernal::npc_giant_infernalAI::npc_giant_infernalAI(), npc_hol_monument::npc_hol_monumentAI::npc_hol_monumentAI(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::npc_mageguard_dalaranAI(), npc_pos_freed_slave::npc_pos_freed_slaveAI::npc_pos_freed_slaveAI(), npc_q24545_vegard::npc_q24545_vegardAI::npc_q24545_vegardAI(), npc_rinji::npc_rinjiAI::npc_rinjiAI(), npc_xt002_heart::npc_xt002_heartAI::npc_xt002_heartAI(), spell_halion_twilight_phasing::spell_halion_twilight_phasing_AuraScript::OnApply(), spell_alar_ember_blast_death::spell_alar_ember_blast_death_AuraScript::OnApply(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnCreatureCreate(), instance_dire_maul::instance_dire_maul_InstanceMapScript::OnCreatureCreate(), NPCStaveQuestAI::PrepareForEncounter(), PretendToDie(), Creature::RefreshSwimmingFlag(), boss_keristrasza::boss_keristraszaAI::RemovePrison(), npc_grimstone::npc_grimstoneAI::Reset(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::Reset(), boss_rend_blackhand::boss_rend_blackhandAI::Reset(), boss_nefarian::Reset(), npc_death_knight_initiate::npc_death_knight_initiateAI::Reset(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::Reset(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::Reset(), boss_nalorakk::boss_nalorakkAI::Reset(), npc_batrider::Reset(), npc_hallows_end_soh::Reset(), npc_ancient_wisp::npc_ancient_wispAI::Reset(), boss_cthun::Reset(), npc_depth_charge::npc_depth_chargeAI::Reset(), npc_draenei_survivor::npc_draenei_survivorAI::Reset(), npc_injured_draenei::npc_injured_draeneiAI::Reset(), npc_death_ravager::npc_death_ravagerAI::Reset(), npc_giant_spotlight::npc_giant_spotlightAI::Reset(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::Reset(), npc_enraged_panther::npc_enraged_pantherAI::Reset(), boss_jedoga_shadowseeker::Reset(), boss_black_knight::boss_black_knightAI::Reset(), npc_announcer_toc5::npc_announcer_toc5AI::Reset(), boss_anubarak_trial::boss_anubarak_trialAI::Reset(), boss_novos::boss_novosAI::Reset(), boss_tyrannus::boss_tyrannusAI::Reset(), boss_drakkari_colossus::boss_drakkari_colossusAI::Reset(), boss_thaddius::boss_thaddiusAI::Reset(), boss_malygos::boss_malygosAI::Reset(), boss_eregos::boss_eregosAI::Reset(), boss_urom::boss_uromAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_loken::boss_lokenAI::Reset(), boss_sjonnir::boss_sjonnirAI::Reset(), boss_flame_leviathan::boss_flame_leviathanAI::Reset(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::Reset(), boss_kologarn::boss_kologarnAI::Reset(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::Reset(), boss_palehoof::boss_palehoofAI::Reset(), npc_massive_jormungar::npc_massive_jormungarAI::Reset(), npc_ferocious_rhino::npc_ferocious_rhinoAI::Reset(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::Reset(), npc_frenzied_worgen::npc_frenzied_worgenAI::Reset(), boss_ymiron::boss_ymironAI::Reset(), npc_drakuru_shackles::npc_drakuru_shacklesAI::Reset(), boss_shade_of_akama::boss_shade_of_akamaAI::Reset(), boss_the_lurker_below::boss_the_lurker_belowAI::Reset(), npc_naga_distiller::npc_naga_distillerAI::Reset(), boss_broggok::boss_broggokAI::Reset(), boss_kelidan_the_breaker::boss_kelidan_the_breakerAI::Reset(), boss_magtheridon::boss_magtheridonAI::Reset(), boss_grand_warlock_nethekurse::boss_grand_warlock_nethekurseAI::Reset(), boss_kaelthas::boss_kaelthasAI::Reset(), npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::Reset(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), instance_blood_furnace::instance_blood_furnace_InstanceMapScript::ResetPrisoner(), Player::SendLoot(), SetCharm(), SetCharmedBy(), SetImmuneToNPC(), SetImmuneToPC(), SetInCombatState(), Player::SetIsSpectator(), SetMinion(), SetStunned(), SetSwim(), boss_victor_nefarius::boss_victor_nefariusAI::sGossipSelect(), Battlefield::ShowNpc(), boss_zuljin::boss_zuljinAI::SpawnAdds(), netherspite_infernal::netherspite_infernalAI::SpellHit(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), npc_wounded_skirmisher::SpellHit(), npc_venture_co_straggler::npc_venture_co_stragglerAI::SpellHit(), npc_nether_drake::npc_nether_drakeAI::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), boss_ionar::boss_ionarAI::Split(), boss_noth::boss_nothAI::StartBalconyPhase(), boss_lord_valthalak::boss_lord_valthalakAI::StartTalking(), boss_ouro::Submerge(), npc_drakonid_spawner::SummonedCreatureDies(), boss_jedoga_shadowseeker::SummonedCreatureDies(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), npc_blistering_zombie::npc_blistering_zombieAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_azure_saboteur::npc_azure_saboteurAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_the_lurker_below::boss_the_lurker_belowAI::UpdateAI(), boss_ahune::boss_ahuneAI::UpdateAI(), boss_kaelthas::boss_kaelthasAI::UpdateAI(), npc_nether_drake::npc_nether_drakeAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), boss_ichoron::boss_ichoronAI::UpdateAI(), npc_injured_patient::npc_injured_patientAI::UpdateAI(), and Creature::UpdateEntry().

◆ SetUnitFlag2()

◆ SetUnitMovementFlags()

◆ SetVisible()

void Unit::SetVisible ( bool  x)
14135{
14136 if (!x)
14138 else
14140
14142}
@ SEC_GAMEMASTER
Definition: Common.h:68

References WorldObject::m_serverSideVisibility, SEC_GAMEMASTER, SEC_PLAYER, SERVERSIDE_VISIBILITY_GM, FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), and UpdateObjectVisibility().

Referenced by _ExitVehicle(), boss_felmyst::boss_felmystAI::boss_felmystAI(), Creature::Create(), spell_rotface_unstable_ooze_explosion_suicide::spell_rotface_unstable_ooze_explosion_suicide_AuraScript::DespawnSelf(), boss_victor_nefarius::boss_victor_nefariusAI::DoAction(), boss_felmyst::boss_felmystAI::DoAction(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), boss_the_lurker_below::boss_the_lurker_belowAI::DoAction(), boss_pathaleon_the_calculator::boss_pathaleon_the_calculatorAI::DoAction(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::EnterEvadeMode(), boss_shade_of_akama::boss_shade_of_akamaAI::EnterEvadeMode(), HideNpcEvent::Execute(), UtherBatteredHiltEvent::Execute(), npc_rocket_propelled_warhead::npc_rocket_propelled_warheadAI::FinishQuest(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), BattlegroundSA::HandleKillUnit(), Battlefield::HideNpc(), boss_kiljaeden::boss_kiljaedenAI::InitializeAI(), boss_sapphiron::boss_sapphironAI::InitializeAI(), boss_pathaleon_the_calculator::boss_pathaleon_the_calculatorAI::InitializeAI(), hyjalAI::JustDied(), npc_xt002_heart::npc_xt002_heartAI::JustDied(), boss_kalecgos::boss_kalecgosAI::JustReachedHome(), npc_rocket_propelled_warhead::npc_rocket_propelled_warheadAI::JustReachedHome(), SmartAI::JustRespawned(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustRespawned(), boss_hazzarah::JustSummoned(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::MoveInLineOfSight(), npc_blood_queen_lana_thel::npc_blood_queen_lana_thelAI::MovementInform(), boss_vazruden_the_herald::boss_vazruden_the_heraldAI::MovementInform(), npc_enslaved_netherwing_drake::npc_enslaved_netherwing_drakeAI::MovementInform(), npc_madrigosa::npc_madrigosaAI::npc_madrigosaAI(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::npc_time_lost_proto_drakeAI(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::OnCreatureCreate(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::OnCreatureCreate(), instance_forge_of_souls::instance_forge_of_souls_InstanceScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_pit_of_saron::instance_pit_of_saron_InstanceScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::PassengerBoarded(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_midnight::boss_midnightAI::Reset(), boss_servant_quarters::Reset(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::Reset(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::Reset(), boss_muru::boss_muruAI::Reset(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::Reset(), boss_eye_of_cthun::Reset(), npc_murkdeep::npc_murkdeepAI::Reset(), npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI::Reset(), boss_halion::boss_halionAI::Reset(), npc_pos_leader::npc_pos_leaderAI::Reset(), npc_blood_queen_lana_thel::npc_blood_queen_lana_thelAI::Reset(), boss_ionar::boss_ionarAI::Reset(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::Reset(), npc_minigob_manabonk::npc_minigob_manabonkAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::Reset(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::Reset(), npc_akama_illidan::npc_akama_illidanAI::Reset(), boss_the_lurker_below::boss_the_lurker_belowAI::Reset(), boss_vazruden_the_herald::boss_vazruden_the_heraldAI::Reset(), npc_enslaved_netherwing_drake::npc_enslaved_netherwing_drakeAI::Reset(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::Reset(), instance_hyjal::instance_mount_hyjal_InstanceMapScript::SetData(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SetData(), instance_ulduar::instance_ulduar_InstanceMapScript::ShowKeeperGossip(), Battlefield::ShowNpc(), boss_ionar::boss_ionarAI::Split(), boss_archimonde::boss_archimondeAI::SummonDoomfire(), boss_midnight::boss_midnightAI::UpdateAI(), boss_servant_quarters::UpdateAI(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), boss_muru::boss_muruAI::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), boss_archimonde::boss_archimondeAI::UpdateAI(), npc_giant_infernal::npc_giant_infernalAI::UpdateAI(), hyjalAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_ionar::boss_ionarAI::UpdateAI(), npc_vh_teleportation_portal::npc_vh_teleportation_portalAI::UpdateAI(), npc_minigob_manabonk::npc_minigob_manabonkAI::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::UpdateAI(), boss_shade_of_akama::boss_shade_of_akamaAI::UpdateAI(), boss_ahune::boss_ahuneAI::UpdateAI(), npc_commander_dawnforge::npc_commander_dawnforgeAI::UpdateAI(), SmartAI::UpdateDespawn(), npc_grimstone::npc_grimstoneAI::UpdateEscortAI(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::UpdateEscortAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), and npc_taretha::npc_tarethaAI::WaypointReached().

◆ SetVisibleAura()

void Unit::SetVisibleAura ( uint8  slot,
AuraApplication aur 
)
inline

◆ SetWalk()

bool Unit::SetWalk ( bool  enable)
virtual

Reimplemented in Creature.

20764{
20765 if (enable == IsWalking())
20766 return false;
20767
20768 if (enable)
20770 else
20772
20774 return true;
20775}
bool IsWalking() const
Definition: Unit.h:2379

References AddUnitMovementFlag(), IsWalking(), MOVEMENTFLAG_WALKING, propagateSpeedChange(), and RemoveUnitMovementFlag().

Referenced by debug_commandscript::HandleDebugMoveflagsCommand(), SetCharm(), and Creature::SetWalk().

◆ SetWaterWalking()

bool Unit::SetWaterWalking ( bool  enable,
bool  packetOnly = false 
)
virtual

◆ SpellBaseDamageBonusDone()

int32 Unit::SpellBaseDamageBonusDone ( SpellSchoolMask  schoolMask)
11861{
11862 int32 DoneAdvertisedBenefit = 0;
11863
11865 for (AuraEffectList::const_iterator i = mDamageDone.begin(); i != mDamageDone.end(); ++i)
11866 if (((*i)->GetMiscValue() & schoolMask) != 0 &&
11867 (*i)->GetSpellInfo()->EquippedItemClass == -1 &&
11868 // -1 == any item class (not wand then)
11869 (*i)->GetSpellInfo()->EquippedItemInventoryTypeMask == 0)
11870 // 0 == any inventory type (not wand then)
11871 DoneAdvertisedBenefit += (*i)->GetAmount();
11872
11873 if (GetTypeId() == TYPEID_PLAYER)
11874 {
11875 // Base value
11876 DoneAdvertisedBenefit += ToPlayer()->GetBaseSpellPowerBonus();
11877
11878 // Damage bonus from stats
11880 for (AuraEffectList::const_iterator i = mDamageDoneOfStatPercent.begin(); i != mDamageDoneOfStatPercent.end(); ++i)
11881 {
11882 if ((*i)->GetMiscValue() & schoolMask)
11883 {
11884 // stat used stored in miscValueB for this aura
11885 Stats usedStat = Stats((*i)->GetMiscValueB());
11886 DoneAdvertisedBenefit += int32(CalculatePct(GetStat(usedStat), (*i)->GetAmount()));
11887 }
11888 }
11889 // ... and attack power
11891 for (AuraEffectList::const_iterator i = mDamageDonebyAP.begin(); i != mDamageDonebyAP.end(); ++i)
11892 if ((*i)->GetMiscValue() & schoolMask)
11893 DoneAdvertisedBenefit += int32(CalculatePct(GetTotalAttackPowerValue(BASE_ATTACK), (*i)->GetAmount()));
11894 }
11895 return DoneAdvertisedBenefit;
11896}
@ SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER
Definition: SpellAuraDefines.h:300
@ SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT
Definition: SpellAuraDefines.h:237
@ SPELL_AURA_MOD_DAMAGE_DONE
Definition: SpellAuraDefines.h:76
uint32 GetBaseSpellPowerBonus()
Definition: Player.h:1921

References BASE_ATTACK, CalculatePct(), GetAuraEffectsByType(), Player::GetBaseSpellPowerBonus(), GetStat(), GetTotalAttackPowerValue(), Object::GetTypeId(), SPELL_AURA_MOD_DAMAGE_DONE, SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER, SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by spell_item_wraith_scythe_drain_life::CalculateDamage(), spell_mage_ice_barrier_aura::CalculateSpellAmount(), spell_mage_ice_barrier::CalculateSpellAmount(), Spell::EffectWeaponDmg(), HandleDummyAuraProc(), spell_pal_seal_of_righteousness::HandleProc(), SpellDamageBonusDone(), lfg::LFGMgr::UpdateRaidBrowser(), and Player::UpdateSpellDamageAndHealingBonus().

◆ SpellBaseDamageBonusTaken()

int32 Unit::SpellBaseDamageBonusTaken ( SpellSchoolMask  schoolMask,
bool  isDoT = false 
)
11899{
11900 int32 TakenAdvertisedBenefit = 0;
11901
11903 for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i)
11904 if (((*i)->GetMiscValue() & schoolMask) != 0)
11905 {
11906 // Xinef: if we have DoT damage type and aura has charges, check if it affects DoTs
11907 // Xinef: required for hemorrhage & rupture / garrote
11908 if (isDoT && (*i)->GetBase()->IsUsingCharges() && !((*i)->GetSpellInfo()->ProcFlags & PROC_FLAG_TAKEN_PERIODIC))
11909 continue;
11910
11911 TakenAdvertisedBenefit += (*i)->GetAmount();
11912 }
11913
11914 return TakenAdvertisedBenefit;
11915}

References GetAuraEffectsByType(), PROC_FLAG_TAKEN_PERIODIC, and SPELL_AURA_MOD_DAMAGE_TAKEN.

Referenced by HandleDummyAuraProc(), spell_pal_seal_of_righteousness::HandleProc(), and SpellDamageBonusTaken().

◆ SpellBaseHealingBonusDone()

int32 Unit::SpellBaseHealingBonusDone ( SpellSchoolMask  schoolMask)
12619{
12620 int32 AdvertisedBenefit = 0;
12621
12623 for (AuraEffectList::const_iterator i = mHealingDone.begin(); i != mHealingDone.end(); ++i)
12624 if (!(*i)->GetMiscValue() || ((*i)->GetMiscValue() & schoolMask) != 0)
12625 AdvertisedBenefit += (*i)->GetAmount();
12626
12627 // Healing bonus of spirit, intellect and strength
12628 if (GetTypeId() == TYPEID_PLAYER)
12629 {
12630 // Base value
12631 AdvertisedBenefit += ToPlayer()->GetBaseSpellPowerBonus();
12632
12633 // Healing bonus from stats
12635 for (AuraEffectList::const_iterator i = mHealingDoneOfStatPercent.begin(); i != mHealingDoneOfStatPercent.end(); ++i)
12636 {
12637 // stat used dependent from misc value (stat index)
12638 Stats usedStat = Stats((*i)->GetSpellInfo()->Effects[(*i)->GetEffIndex()].MiscValue);
12639 AdvertisedBenefit += int32(CalculatePct(GetStat(usedStat), (*i)->GetAmount()));
12640 }
12641
12642 // ... and attack power
12644 for (AuraEffectList::const_iterator i = mHealingDonebyAP.begin(); i != mHealingDonebyAP.end(); ++i)
12645 if ((*i)->GetMiscValue() & schoolMask)
12646 AdvertisedBenefit += int32(CalculatePct(GetTotalAttackPowerValue(BASE_ATTACK), (*i)->GetAmount()));
12647 }
12648 return AdvertisedBenefit;
12649}
@ SPELL_AURA_MOD_HEALING_DONE
Definition: SpellAuraDefines.h:198
@ SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT
Definition: SpellAuraDefines.h:238
@ SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER
Definition: SpellAuraDefines.h:301

References BASE_ATTACK, CalculatePct(), GetAuraEffectsByType(), Player::GetBaseSpellPowerBonus(), GetStat(), GetTotalAttackPowerValue(), Object::GetTypeId(), SPELL_AURA_MOD_HEALING_DONE, SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER, SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by CalculateSpellAmount(), SpellHealingBonusDone(), lfg::LFGMgr::UpdateRaidBrowser(), and Player::UpdateSpellDamageAndHealingBonus().

◆ SpellBaseHealingBonusTaken()

int32 Unit::SpellBaseHealingBonusTaken ( SpellSchoolMask  schoolMask)
12652{
12653 int32 AdvertisedBenefit = 0;
12654
12656 for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i)
12657 if (((*i)->GetMiscValue() & schoolMask) != 0)
12658 AdvertisedBenefit += (*i)->GetAmount();
12659
12660 return AdvertisedBenefit;
12661}
@ SPELL_AURA_MOD_HEALING
Definition: SpellAuraDefines.h:178

References GetAuraEffectsByType(), and SPELL_AURA_MOD_HEALING.

Referenced by SpellHealingBonusTaken().

◆ SpellCriticalDamageBonus()

uint32 Unit::SpellCriticalDamageBonus ( Unit const *  caster,
SpellInfo const *  spellProto,
uint32  damage,
Unit const *  victim 
)
static
12205{
12206 // Calculate critical bonus
12207 int32 crit_bonus = damage;
12208 float crit_mod = 0.0f;
12209
12210 switch (spellProto->DmgClass)
12211 {
12212 case SPELL_DAMAGE_CLASS_MELEE: // for melee based spells is 100%
12214 // TODO: write here full calculation for melee/ranged spells
12215 crit_bonus += damage;
12216 break;
12217 default:
12218 crit_bonus += damage / 2; // for spells is 50%
12219 break;
12220 }
12221
12222 if (caster)
12223 {
12224 crit_mod += caster->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, spellProto->GetSchoolMask());
12225
12226 if (victim)
12227 crit_mod += caster->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, victim->GetCreatureTypeMask());
12228
12229 if (crit_bonus != 0 && crit_mod != 0.0f)
12230 AddPct(crit_bonus, crit_mod);
12231
12232 crit_bonus -= damage;
12233
12234 // adds additional damage to critBonus (from talents)
12235 if (Player* modOwner = caster->GetSpellModOwner())
12236 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
12237
12238 crit_bonus += damage;
12239 }
12240
12241 return crit_bonus;
12242}

References AddPct(), SpellInfo::DmgClass, GetCreatureTypeMask(), SpellInfo::GetSchoolMask(), GetSpellModOwner(), GetTotalAuraModifierByMiscMask(), SpellInfo::Id, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_RANGED, and SPELLMOD_CRIT_DAMAGE_BONUS.

Referenced by CalculateSpellDamageTaken(), AuraEffect::HandlePeriodicDamageAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ SpellCriticalHealingBonus()

uint32 Unit::SpellCriticalHealingBonus ( Unit const *  caster,
SpellInfo const *  spellProto,
uint32  damage,
Unit const *  victim 
)
static
12245{
12246 // Calculate critical bonus
12247 int32 crit_bonus;
12248 switch (spellProto->DmgClass)
12249 {
12250 case SPELL_DAMAGE_CLASS_MELEE: // for melee based spells is 100%
12252 // TODO: write here full calculation for melee/ranged spells
12253 crit_bonus = damage;
12254 break;
12255 default:
12256 crit_bonus = damage / 2; // for spells is 50%
12257 break;
12258 }
12259
12260 if (caster)
12261 {
12262 if (victim)
12263 {
12264 uint32 creatureTypeMask = victim->GetCreatureTypeMask();
12265 crit_bonus = int32(crit_bonus * caster->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, creatureTypeMask));
12266 }
12267
12268 // adds additional damage to critBonus (from talents)
12269 // xinef: used for death knight death coil
12270 if (Player* modOwner = caster->GetSpellModOwner())
12271 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
12272 }
12273
12274 if (crit_bonus > 0)
12275 damage += crit_bonus;
12276
12277 if (caster)
12278 damage = int32(float(damage) * caster->GetTotalAuraMultiplier(SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT));
12279
12280 return damage;
12281}
@ SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT
Definition: SpellAuraDefines.h:113

References SpellInfo::DmgClass, GetCreatureTypeMask(), GetSpellModOwner(), GetTotalAuraMultiplier(), GetTotalAuraMultiplierByMiscMask(), SpellInfo::Id, SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_RANGED, and SPELLMOD_CRIT_DAMAGE_BONUS.

Referenced by Spell::DoAllEffectOnTarget(), and AuraEffect::HandlePeriodicHealAurasTick().

◆ SpellDamageBonusDone()

uint32 Unit::SpellDamageBonusDone ( Unit victim,
SpellInfo const *  spellProto,
uint32  pdamage,
DamageEffectType  damagetype,
uint8  effIndex,
float  TotalMod = 0.0f,
uint32  stack = 1 
)
11572{
11573 if (!spellProto || !victim || damagetype == DIRECT_DAMAGE)
11574 return pdamage;
11575
11576 // Some spells don't benefit from done mods
11577 if (spellProto->HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS))
11578 return pdamage;
11579
11580 // For totems get damage bonus from owner
11581 if (GetTypeId() == TYPEID_UNIT)
11582 {
11583 if (IsTotem())
11584 {
11585 if (Unit* owner = GetOwner())
11586 return owner->SpellDamageBonusDone(victim, spellProto, pdamage, damagetype, effIndex, TotalMod, stack);
11587 }
11588 // Dancing Rune Weapon...
11589 else if (GetEntry() == 27893)
11590 {
11591 if (Unit* owner = GetOwner())
11592 return owner->SpellDamageBonusDone(victim, spellProto, pdamage, damagetype, TotalMod, stack) / 2;
11593 }
11594 }
11595
11596 // Done total percent damage auras
11597 float ApCoeffMod = 1.0f;
11598 int32 DoneTotal = 0;
11599 float DoneTotalMod = TotalMod ? TotalMod : SpellPctDamageModsDone(victim, spellProto, damagetype);
11600
11601 // Config : RATE_CREATURE_X_SPELLDAMAGE & Do Not Modify Pet/Guardian/Mind Controled Damage
11603 DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank);
11604
11605 // Some spells don't benefit from pct done mods
11606 if (!spellProto->HasAttribute(SPELL_ATTR6_IGNORE_CASTER_DAMAGE_MODIFIERS))
11607 {
11608 uint32 creatureTypeMask = victim->GetCreatureTypeMask();
11609 // Add flat bonus from spell damage versus
11611 }
11612
11613 // done scripted mod (take it from owner)
11614 Unit* owner = GetOwner() ? GetOwner() : this;
11615 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
11616 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
11617 {
11618 if (!(*i)->IsAffectedOnSpell(spellProto))
11619 continue;
11620
11621 switch ((*i)->GetMiscValue())
11622 {
11623 case 4418: // Increased Shock Damage
11624 case 4554: // Increased Lightning Damage
11625 case 4555: // Improved Moonfire
11626 case 5142: // Increased Lightning Damage
11627 case 5147: // Improved Consecration / Libram of Resurgence
11628 case 5148: // Idol of the Shooting Star
11629 case 6008: // Increased Lightning Damage
11630 case 8627: // Totem of Hex
11631 {
11632 DoneTotal += (*i)->GetAmount();
11633 break;
11634 }
11635 }
11636 }
11637
11638 // Custom scripted damage
11639 if (spellProto->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT)
11640 {
11641 // Sigil of the Vengeful Heart
11642 if (spellProto->SpellFamilyFlags[0] & 0x2000)
11643 if (AuraEffect* aurEff = GetAuraEffect(64962, EFFECT_1))
11644 AddPct(DoneTotal, aurEff->GetAmount());
11645
11646 // Impurity
11648 AddPct(ApCoeffMod, aurEff->GetAmount());
11649
11650 // Blood Boil - bonus for diseased targets
11651 if (spellProto->SpellFamilyFlags[0] & 0x00040000)
11653 {
11654 DoneTotal += 95;
11655 ApCoeffMod = 1.5835f;
11656 }
11657 }
11658
11659 // Done fixed damage bonus auras
11660 int32 DoneAdvertisedBenefit = SpellBaseDamageBonusDone(spellProto->GetSchoolMask());
11661
11662 // Check for table values
11663 float coeff = spellProto->Effects[effIndex].BonusMultiplier;
11664 SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
11665 if (bonus)
11666 {
11667 if (damagetype == DOT)
11668 {
11669 coeff = bonus->dot_damage;
11670 if (bonus->ap_dot_bonus > 0)
11671 {
11672 WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
11674 APbonus += GetTotalAttackPowerValue(attType);
11675 DoneTotal += int32(bonus->ap_dot_bonus * stack * ApCoeffMod * APbonus);
11676 }
11677 }
11678 else
11679 {
11680 coeff = bonus->direct_damage;
11681 if (bonus->ap_bonus > 0)
11682 {
11683 WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
11685 APbonus += GetTotalAttackPowerValue(attType);
11686 DoneTotal += int32(bonus->ap_bonus * stack * ApCoeffMod * APbonus);
11687 }
11688 }
11689 }
11690
11691 // Default calculation
11692 if (coeff && DoneAdvertisedBenefit)
11693 {
11694 float factorMod = CalculateLevelPenalty(spellProto) * stack;
11695
11696 if (Player* modOwner = GetSpellModOwner())
11697 {
11698 coeff *= 100.0f;
11699 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
11700 coeff /= 100.0f;
11701 }
11702
11703 DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
11704 }
11705
11706 float tmpDamage = (float(pdamage) + DoneTotal) * DoneTotalMod;
11707 // apply spellmod to Done damage (flat and pct)
11708 if (Player* modOwner = GetSpellModOwner())
11709 modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, tmpDamage);
11710
11711 return uint32(std::max(tmpDamage, 0.0f));
11712}
@ SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS
Definition: SpellAuraDefines.h:243
@ SPELLMOD_DOT
Definition: SpellDefines.h:99
@ SPELLMOD_BONUS_MULTIPLIER
Definition: SpellDefines.h:101
@ SPELL_ATTR6_IGNORE_CASTER_DAMAGE_MODIFIERS
Definition: SharedDefines.h:605
float GetSpellDamageMod(int32 Rank)
Definition: Creature.cpp:1571
float SpellPctDamageModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition: Unit.cpp:11240
float CalculateLevelPenalty(SpellInfo const *spellProto) const
Definition: Unit.cpp:3002
Definition: SpellMgr.h:317
float ap_dot_bonus
Definition: SpellMgr.h:321
float dot_damage
Definition: SpellMgr.h:319
float ap_bonus
Definition: SpellMgr.h:320
float direct_damage
Definition: SpellMgr.h:318

References AddPct(), SpellBonusEntry::ap_bonus, SpellBonusEntry::ap_dot_bonus, BASE_ATTACK, CalculateLevelPenalty(), DIRECT_DAMAGE, SpellBonusEntry::direct_damage, SpellInfo::DmgClass, DOT, SpellBonusEntry::dot_damage, EFFECT_1, SpellInfo::Effects, GetAuraEffect(), GetAuraEffectsByType(), GetCreatureTypeMask(), GetDummyAuraEffect(), Object::GetEntry(), Object::GetGUID(), GetOwner(), SpellInfo::GetSchoolMask(), Creature::GetSpellDamageMod(), GetSpellModOwner(), GetTotalAttackPowerValue(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), Object::GetTypeId(), SpellInfo::HasAttribute(), SpellInfo::Id, IsControlledByPlayer(), IsGuardian(), IsPet(), SpellInfo::IsRangedWeaponSpell(), IsTotem(), RANGED_ATTACK, SPELL_ATTR3_IGNORE_CASTER_MODIFIERS, SPELL_ATTR6_IGNORE_CASTER_DAMAGE_MODIFIERS, SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS, SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS, SPELL_DAMAGE_CLASS_MELEE, SpellBaseDamageBonusDone(), SPELLFAMILY_DEATHKNIGHT, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SPELLMOD_BONUS_MULTIPLIER, SPELLMOD_DAMAGE, SPELLMOD_DOT, SpellPctDamageModsDone(), sSpellMgr, Object::ToCreature(), and TYPEID_UNIT.

Referenced by AuraEffect::CalculateAmount(), Spell::EffectHealthLeech(), Spell::EffectPowerDrain(), Spell::EffectSchoolDMG(), spell_warr_bloodthirst::HandleDamage(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), and AuraEffect::HandleProcTriggerDamageAuraProc().

◆ SpellDamageBonusTaken()

uint32 Unit::SpellDamageBonusTaken ( Unit caster,
SpellInfo const *  spellProto,
uint32  pdamage,
DamageEffectType  damagetype,
uint32  stack = 1 
)
11715{
11716 if (!spellProto || damagetype == DIRECT_DAMAGE)
11717 return pdamage;
11718
11719 int32 TakenTotal = 0;
11720 float TakenTotalMod = 1.0f;
11721
11722 // from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
11723 // multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085)
11725 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
11726 if (((*i)->GetMiscValue() & spellProto->GetSchoolMask()))
11727 if (spellProto->ValidateAttribute6SpellDamageMods(caster, *i, damagetype == DOT))
11728 AddPct(TakenTotalMod, (*i)->GetAmount());
11729
11730 TakenTotalMod = processDummyAuras(TakenTotalMod);
11731
11732 // From caster spells
11733 if (caster)
11734 {
11736 for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i)
11737 if ((*i)->GetCasterGUID() == caster->GetGUID() && (*i)->IsAffectedOnSpell(spellProto))
11738 if (spellProto->ValidateAttribute6SpellDamageMods(caster, *i, damagetype == DOT))
11739 AddPct(TakenTotalMod, (*i)->GetAmount());
11740 }
11741
11742 if (uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask())
11743 {
11744 int32 modifierMax = 0;
11745 int32 modifierMin = 0;
11747 for (AuraEffectList::const_iterator i = auraEffectList.begin(); i != auraEffectList.end(); ++i)
11748 {
11749 if (!spellProto->ValidateAttribute6SpellDamageMods(caster, *i, damagetype == DOT))
11750 continue;
11751
11752 // Only death knight spell with this aura
11753 if ((*i)->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT)
11754 if (!caster || caster->GetGUID() != (*i)->GetCasterGUID())
11755 continue;
11756
11757 if (mechanicMask & uint32(1 << (*i)->GetMiscValue()))
11758 {
11759 if ((*i)->GetAmount() > 0)
11760 {
11761 if ((*i)->GetAmount() > modifierMax)
11762 modifierMax = (*i)->GetAmount();
11763 }
11764 else if ((*i)->GetAmount() < modifierMin)
11765 modifierMin = (*i)->GetAmount();
11766 }
11767 }
11768
11769 AddPct(TakenTotalMod, modifierMax);
11770 AddPct(TakenTotalMod, modifierMin);
11771 }
11772
11773 int32 TakenAdvertisedBenefit = SpellBaseDamageBonusTaken(spellProto->GetSchoolMask(), damagetype == DOT);
11774
11775 // Check for table values
11776 float coeff = 0;
11777 SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
11778 if (bonus)
11779 coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage;
11780
11781 // Default calculation
11782 if (TakenAdvertisedBenefit)
11783 {
11784 if (coeff <= 0.0f)
11785 {
11786 if (caster)
11787 coeff = caster->CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack);
11788 else
11789 coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack);
11790 }
11791
11792 float factorMod = CalculateLevelPenalty(spellProto) * stack;
11793 TakenTotal += int32(TakenAdvertisedBenefit * coeff * factorMod);
11794 }
11795
11796 // No positive taken bonus, custom attr
11797 if (spellProto->HasAttribute(SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS) && TakenTotalMod > 1.0f)
11798 {
11799 TakenTotal = 0;
11800 TakenTotalMod = 1.0f;
11801 }
11802
11803 // xinef: sanctified wrath talent
11804 if (caster && TakenTotalMod < 1.0f && caster->HasAuraType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST))
11805 {
11806 float ignoreModifier = 1.0f - TakenTotalMod;
11807 bool addModifier = false;
11809 for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j)
11810 if ((*j)->GetMiscValue() & spellProto->SchoolMask)
11811 {
11812 ApplyPct(ignoreModifier, (*j)->GetAmount());
11813 addModifier = true;
11814 }
11815
11816 if (addModifier)
11817 TakenTotalMod += ignoreModifier;
11818 }
11819
11820 float tmpDamage = (float(pdamage) + TakenTotal) * TakenTotalMod;
11821
11822 return uint32(std::max(tmpDamage, 0.0f));
11823}
float CalculateDefaultCoefficient(SpellInfo const *spellInfo, DamageEffectType damagetype) const
Definition: Unit.cpp:17341

References AddPct(), ApplyPct(), CalculateDefaultCoefficient(), CalculateLevelPenalty(), DIRECT_DAMAGE, SpellBonusEntry::direct_damage, DOT, SpellBonusEntry::dot_damage, SpellInfo::GetAllEffectsMechanicMask(), GetAuraEffectsByType(), Object::GetGUID(), SpellInfo::GetSchoolMask(), SpellInfo::HasAttribute(), HasAuraType(), SpellInfo::Id, processDummyAuras(), SpellInfo::SchoolMask, SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS, SPELL_AURA_MOD_DAMAGE_FROM_CASTER, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, SPELL_AURA_MOD_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT, SpellBaseDamageBonusTaken(), SPELLFAMILY_DEATHKNIGHT, sSpellMgr, and SpellInfo::ValidateAttribute6SpellDamageMods().

Referenced by DealMeleeDamage(), Spell::EffectHealthLeech(), Spell::EffectPowerDrain(), Spell::EffectSchoolDMG(), Aura::HandleAuraSpecificMods(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), and AuraEffect::HandleProcTriggerDamageAuraProc().

◆ SpellDoneCritChance()

float Unit::SpellDoneCritChance ( Unit const *  ,
SpellInfo const *  spellProto,
SpellSchoolMask  schoolMask,
WeaponAttackType  attackType,
bool  skipEffectCheck 
) const
11918{
11919 // Mobs can't crit with spells.
11920 if (GetTypeId() == TYPEID_UNIT && !GetSpellModOwner())
11921 return -100.0f;
11922
11923 // not critting spell
11924 if (spellProto->HasAttribute(SPELL_ATTR2_CANT_CRIT))
11925 return 0.0f;
11926
11927 // Xinef: check if spell is capable of critting, auras requires special aura to crit so they can be skipped
11928 if (!skipEffectCheck && !spellProto->IsCritCapable())
11929 return 0.0f;
11930
11931 float crit_chance = 0.0f;
11932 switch (spellProto->DmgClass)
11933 {
11935 {
11936 if (schoolMask & SPELL_SCHOOL_MASK_NORMAL)
11937 crit_chance = 0.0f;
11938 // For other schools
11939 else if (GetTypeId() == TYPEID_PLAYER)
11940 crit_chance = GetFloatValue(static_cast<uint16>(PLAYER_SPELL_CRIT_PERCENTAGE1) + GetFirstSchoolInMask(schoolMask));
11941 else
11942 {
11943 crit_chance = (float)m_baseSpellCritChance;
11945 }
11946 break;
11947 }
11950 {
11951 if (GetTypeId() == TYPEID_PLAYER)
11952 {
11953 switch (attackType)
11954 {
11955 case BASE_ATTACK:
11957 break;
11958 case OFF_ATTACK:
11960 break;
11961 case RANGED_ATTACK:
11963 break;
11964 default:
11965 break;
11966 }
11967 }
11968 else
11969 {
11970 crit_chance = 5.0f;
11973 }
11975 break;
11976 }
11977 // values overridden in spellmgr for lifebloom and earth shield
11979 default:
11980 return 0.0f;
11981 }
11982
11983 // percent done
11984 // only players use intelligence for critical chance computations
11985 if (Player* modOwner = GetSpellModOwner())
11986 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRITICAL_CHANCE, crit_chance);
11987
11988 // xinef: can be negative!
11989 return crit_chance;
11990}
@ PLAYER_SPELL_CRIT_PERCENTAGE1
Definition: UpdateFields.h:354
@ SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
Definition: SpellAuraDefines.h:134
@ SPELLMOD_CRITICAL_CHANCE
Definition: SpellDefines.h:84
@ SPELL_ATTR2_CANT_CRIT
Definition: SharedDefines.h:457

References BASE_ATTACK, SpellInfo::DmgClass, GetFirstSchoolInMask(), Object::GetFloatValue(), GetSpellModOwner(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), Object::GetTypeId(), SpellInfo::HasAttribute(), SpellInfo::Id, SpellInfo::IsCritCapable(), m_baseSpellCritChance, OFF_ATTACK, PLAYER_CRIT_PERCENTAGE, PLAYER_OFFHAND_CRIT_PERCENTAGE, PLAYER_RANGED_CRIT_PERCENTAGE, PLAYER_SPELL_CRIT_PERCENTAGE1, RANGED_ATTACK, SPELL_ATTR2_CANT_CRIT, SPELL_AURA_MOD_CRIT_PCT, SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELL_SCHOOL_MASK_NORMAL, SPELLMOD_CRITICAL_CHANCE, TYPEID_PLAYER, and TYPEID_UNIT.

Referenced by Spell::DoAllEffectOnLaunchTarget().

◆ SpellHealingBonusDone()

uint32 Unit::SpellHealingBonusDone ( Unit victim,
SpellInfo const *  spellProto,
uint32  healamount,
DamageEffectType  damagetype,
uint8  effIndex,
float  TotalMod = 0.0f,
uint32  stack = 1 
)
12376{
12377 // For totems get healing bonus from owner (statue isn't totem in fact)
12378 if (GetTypeId() == TYPEID_UNIT && IsTotem())
12379 if (Unit* owner = GetOwner())
12380 return owner->SpellHealingBonusDone(victim, spellProto, healamount, damagetype, effIndex, TotalMod, stack);
12381
12382 // No bonus healing for potion spells
12383 if (spellProto->SpellFamilyName == SPELLFAMILY_POTION)
12384 return healamount;
12385
12386 float ApCoeffMod = 1.0f;
12387 float DoneTotalMod = TotalMod ? TotalMod : SpellPctHealingModsDone(victim, spellProto, damagetype);
12388 int32 DoneTotal = 0;
12389
12390 // done scripted mod (take it from owner)
12391 Unit* owner = GetOwner() ? GetOwner() : this;
12392 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
12393 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
12394 {
12395 if (!(*i)->IsAffectedOnSpell(spellProto))
12396 continue;
12397 switch ((*i)->GetMiscValue())
12398 {
12399 case 4415: // Increased Rejuvenation Healing
12400 case 4953:
12401 DoneTotal += (*i)->GetAmount() / 5; // 5 ticks of Rejuvenation
12402 break;
12403 case 3736: // Hateful Totem of the Third Wind / Increased Lesser Healing Wave / LK Arena (4/5/6) Totem of the Third Wind / Savage Totem of the Third Wind
12404 DoneTotal += (*i)->GetAmount();
12405 break;
12406 }
12407 }
12408
12409 // Done fixed damage bonus auras
12410 int32 DoneAdvertisedBenefit = SpellBaseHealingBonusDone(spellProto->GetSchoolMask());
12411 float coeff = spellProto->Effects[effIndex].BonusMultiplier;
12412
12413 switch (spellProto->SpellFamilyName)
12414 {
12416 // Impurity
12418 AddPct(ApCoeffMod, aurEff->GetAmount());
12419
12420 break;
12421 }
12422
12423 // Check for table values
12424 SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
12425 if(bonus)
12426 {
12427 if (damagetype == DOT)
12428 {
12429 coeff = bonus->dot_damage;
12430 if (bonus->ap_dot_bonus > 0)
12431 DoneTotal += int32(bonus->ap_dot_bonus * ApCoeffMod * stack * GetTotalAttackPowerValue(
12432 (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK));
12433 }
12434 else
12435 {
12436 coeff = bonus->direct_damage;
12437 if (bonus->ap_bonus > 0)
12438 DoneTotal += int32(bonus->ap_bonus * ApCoeffMod * stack * GetTotalAttackPowerValue(
12439 (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK));
12440 }
12441 }
12442 else
12443 {
12444 // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default
12445 if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE)
12446 return healamount;
12447 }
12448
12449 // Default calculation
12450 if (DoneAdvertisedBenefit)
12451 {
12452 float factorMod = CalculateLevelPenalty(spellProto) * stack;
12453 if (Player* modOwner = GetSpellModOwner())
12454 {
12455 coeff *= 100.0f;
12456 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
12457 coeff /= 100.0f;
12458 }
12459 DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
12460 }
12461
12462 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
12463 {
12464 switch (spellProto->Effects[i].ApplyAuraName)
12465 {
12466 // Bonus healing does not apply to these spells
12469 DoneTotal = 0;
12470 break;
12471 }
12472 if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH)
12473 DoneTotal = 0;
12474 }
12475
12476 // use float as more appropriate for negative values and percent applying
12477 float heal = float(int32(healamount) + DoneTotal) * DoneTotalMod;
12478 // apply spellmod to Done amount
12479
12480 if (Player* modOwner = GetSpellModOwner())
12481 modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, heal);
12482
12483 return uint32(std::max(heal, 0.0f));
12484}
@ SPELL_AURA_PERIODIC_HEALTH_FUNNEL
Definition: SpellAuraDefines.h:125
int32 SpellBaseHealingBonusDone(SpellSchoolMask schoolMask)
Definition: Unit.cpp:12618
float SpellPctHealingModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition: Unit.cpp:12283

References AddPct(), SpellBonusEntry::ap_bonus, SpellBonusEntry::ap_dot_bonus, BASE_ATTACK, CalculateLevelPenalty(), SpellBonusEntry::direct_damage, SpellInfo::DmgClass, DOT, SpellBonusEntry::dot_damage, SpellInfo::Effects, GetAuraEffectsByType(), GetDummyAuraEffect(), GetOwner(), SpellInfo::GetSchoolMask(), GetSpellModOwner(), GetTotalAttackPowerValue(), Object::GetTypeId(), SpellInfo::Id, SpellInfo::IsRangedWeaponSpell(), IsTotem(), MAX_SPELL_EFFECTS, RANGED_ATTACK, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_HEALTH_FUNNEL, SPELL_AURA_PERIODIC_LEECH, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_EFFECT_HEALTH_LEECH, SpellBaseHealingBonusDone(), SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_POTION, SpellInfo::SpellFamilyName, SPELLMOD_BONUS_MULTIPLIER, SPELLMOD_DAMAGE, SPELLMOD_DOT, SpellPctHealingModsDone(), sSpellMgr, and TYPEID_UNIT.

Referenced by AuraEffect::CalculateAmount(), Spell::DoAllEffectOnTarget(), Spell::EffectHeal(), Spell::EffectHealMechanical(), Spell::EffectHealPct(), spell_dru_lifebloom::HandleDispel(), AuraEffect::HandlePeriodicHealAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ SpellHealingBonusTaken()

uint32 Unit::SpellHealingBonusTaken ( Unit caster,
SpellInfo const *  spellProto,
uint32  healamount,
DamageEffectType  damagetype,
uint32  stack = 1 
)
12487{
12488 float TakenTotalMod = 1.0f;
12489 float minval = 0.0f;
12490
12491 // Healing taken percent
12492 if (!sScriptMgr->OnSpellHealingBonusTakenNegativeModifiers(this, caster, spellProto, minval))
12493 {
12495 }
12496
12497 if (minval)
12498 AddPct(TakenTotalMod, minval);
12499
12501 if (maxval)
12502 AddPct(TakenTotalMod, maxval);
12503
12504 // Tenacity increase healing % taken
12505 if (AuraEffect const* Tenacity = GetAuraEffect(58549, 0))
12506 AddPct(TakenTotalMod, Tenacity->GetAmount());
12507
12508 // Healing Done
12509 int32 TakenTotal = 0;
12510
12511 // Taken fixed damage bonus auras
12512 int32 TakenAdvertisedBenefit = SpellBaseHealingBonusTaken(spellProto->GetSchoolMask());
12513
12514 // Nourish cast, glyph of nourish
12515 if (spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags[1] & 0x2000000 && caster)
12516 {
12517 bool any = false;
12518 bool hasglyph = caster->GetAuraEffectDummy(62971);
12520 for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
12521 {
12522 if (((*i)->GetCasterGUID() == caster->GetGUID()))
12523 {
12524 SpellInfo const* spell = (*i)->GetSpellInfo();
12525 // Rejuvenation, Regrowth, Lifebloom, or Wild Growth
12526 if (!any && spell->SpellFamilyFlags.HasFlag(0x50, 0x4000010, 0))
12527 {
12528 TakenTotalMod *= 1.2f;
12529 any = true;
12530 }
12531
12532 if (hasglyph)
12533 TakenTotalMod += 0.06f;
12534 }
12535 }
12536 }
12537
12538 if (damagetype == DOT)
12539 {
12540 // Healing over time taken percent
12541 float minval_hot = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT));
12542 if (minval_hot)
12543 AddPct(TakenTotalMod, minval_hot);
12544
12545 float maxval_hot = float(GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT));
12546 if (maxval_hot)
12547 AddPct(TakenTotalMod, maxval_hot);
12548 }
12549
12550 // Check for table values
12551 SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
12552 float coeff = 0;
12553 float factorMod = 1.0f;
12554 if (bonus)
12555 coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage;
12556 else
12557 {
12558 // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default
12559 if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE)
12560 {
12561 healamount = uint32(std::max((float(healamount) * TakenTotalMod), 0.0f));
12562 return healamount;
12563 }
12564 }
12565
12566 // Default calculation
12567 if (TakenAdvertisedBenefit)
12568 {
12569 float TakenCoeff = 0.0f;
12570 if (coeff <= 0)
12571 coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack) * 1.88f; // As wowwiki says: C = (Cast Time / 3.5) * 1.88 (for healing spells)
12572
12573 factorMod *= CalculateLevelPenalty(spellProto) * int32(stack);
12574 if (Player* modOwner = GetSpellModOwner())
12575 {
12576 coeff *= 100.0f;
12577 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
12578 coeff /= 100.0f;
12579 }
12580
12581 TakenTotal += int32(TakenAdvertisedBenefit * (coeff > 0 ? coeff : TakenCoeff) * factorMod);
12582 }
12583
12584 if (caster)
12585 {
12587 for (AuraEffectList::const_iterator i = mHealingGet.begin(); i != mHealingGet.end(); ++i)
12588 if (caster->GetGUID() == (*i)->GetCasterGUID() && (*i)->IsAffectedOnSpell(spellProto))
12589 AddPct(TakenTotalMod, (*i)->GetAmount());
12590 }
12591
12592 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
12593 {
12594 switch (spellProto->Effects[i].ApplyAuraName)
12595 {
12596 // Bonus healing does not apply to these spells
12599 TakenTotal = 0;
12600 break;
12601 }
12602 if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH)
12603 TakenTotal = 0;
12604 }
12605
12606 // No positive taken bonus, custom attr
12607 if ((spellProto->HasAttribute(SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS) || spellProto->HasAttribute(SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS)) && TakenTotalMod > 1.0f)
12608 {
12609 TakenTotal = 0;
12610 TakenTotalMod = 1.0f;
12611 }
12612
12613 float heal = float(int32(healamount) + TakenTotal) * TakenTotalMod;
12614
12615 return uint32(std::max(heal, 0.0f));
12616}
@ SPELL_AURA_MOD_HEALING_RECEIVED
Definition: SpellAuraDefines.h:346
@ SPELL_AURA_MOD_HEALING_PCT
Definition: SpellAuraDefines.h:181
@ SPELL_AURA_MOD_HOT_PCT
Definition: SpellAuraDefines.h:322
@ SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS
Definition: SharedDefines.h:603
int32 GetMaxPositiveAuraModifier(AuraType auratype)
Definition: Unit.cpp:5847
int32 GetMaxNegativeAuraModifier(AuraType auratype) const
Definition: Unit.cpp:5861
int32 SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask)
Definition: Unit.cpp:12651

References AddPct(), SpellBonusEntry::direct_damage, SpellInfo::DmgClass, DOT, SpellBonusEntry::dot_damage, GetAuraEffect(), GetAuraEffectDummy(), GetAuraEffectsByType(), Object::GetGUID(), GetMaxNegativeAuraModifier(), GetMaxPositiveAuraModifier(), SpellInfo::GetSchoolMask(), flag96::HasFlag(), SpellInfo::Id, SPELL_AURA_MOD_HEALING_PCT, SPELL_AURA_MOD_HOT_PCT, SPELL_AURA_PERIODIC_HEAL, SPELL_DAMAGE_CLASS_NONE, SpellBaseHealingBonusTaken(), SPELLFAMILY_DRUID, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, sScriptMgr, and sSpellMgr.

Referenced by spell_dru_lifebloom::AfterRemove(), Spell::DoAllEffectOnTarget(), Spell::EffectHeal(), Spell::EffectHealMechanical(), Spell::EffectHealPct(), spell_pri_renew::HandleApplyEffect(), Aura::HandleAuraSpecificMods(), AuraEffect::HandlePeriodicHealAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ SpellHitResult() [1/2]

SpellMissInfo Unit::SpellHitResult ( Unit victim,
Spell const *  spell,
bool  canReflect = false 
)
3489{
3490 SpellInfo const* spellInfo = spell->GetSpellInfo();
3491
3492 // Check for immune
3493 if (victim->IsImmunedToSpell(spellInfo, spell))
3494 {
3495 return SPELL_MISS_IMMUNE;
3496 }
3497
3498 // All positive spells can`t miss
3499 // TODO: client not show miss log for this spells - so need find info for this in dbc and use it!
3500 if ((spellInfo->IsPositive() || spellInfo->HasEffect(SPELL_EFFECT_DISPEL))
3501 && (!IsHostileTo(victim))) // prevent from affecting enemy by "positive" spell
3502 {
3503 return SPELL_MISS_NONE;
3504 }
3505
3506 // Check for immune
3507 // xinef: check for school immunity only
3508 if (victim->IsImmunedToSchool(spell))
3509 {
3510 return SPELL_MISS_IMMUNE;
3511 }
3512
3513 if (this == victim)
3514 {
3515 return SPELL_MISS_NONE;
3516 }
3517
3518 // Return evade for units in evade mode
3519 if (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsEvadingAttacks() && !spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE) &&
3521 {
3522 return SPELL_MISS_EVADE;
3523 }
3524
3525 // Try victim reflect spell
3526 if (CanReflect)
3527 {
3528 int32 reflectchance = victim->GetTotalAuraModifier(SPELL_AURA_REFLECT_SPELLS);
3529 Unit::AuraEffectList const& mReflectSpellsSchool = victim->GetAuraEffectsByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL);
3530 for (Unit::AuraEffectList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i)
3531 {
3532 if ((*i)->GetMiscValue() & spell->GetSpellSchoolMask())
3533 {
3534 reflectchance += (*i)->GetAmount();
3535 }
3536 }
3537
3538 if (reflectchance > 0 && roll_chance_i(reflectchance))
3539 {
3540 // Start triggers for remove charges if need (trigger only for victim, and mark as active spell)
3541 //ProcDamageAndSpell(victim, PROC_FLAG_NONE, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG, PROC_EX_REFLECT, 1, BASE_ATTACK, spell);
3542 return SPELL_MISS_REFLECT;
3543 }
3544 }
3545
3546 switch (spellInfo->DmgClass)
3547 {
3550 return MeleeSpellHitResult(victim, spellInfo);
3552 {
3553 if (spellInfo->SpellFamilyName)
3554 {
3555 return SPELL_MISS_NONE;
3556 }
3557
3558 // Xinef: apply DAMAGE_CLASS_MAGIC conditions to damaging DAMAGE_CLASS_NONE spells
3559 for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i)
3560 {
3561 if (spellInfo->Effects[i].Effect && spellInfo->Effects[i].Effect != SPELL_EFFECT_SCHOOL_DAMAGE)
3562 {
3563 if (spellInfo->Effects[i].ApplyAuraName != SPELL_AURA_PERIODIC_DAMAGE)
3564 {
3565 return SPELL_MISS_NONE;
3566 }
3567 }
3568 }
3569 [[fallthrough]];
3570 }
3572 return MagicSpellHitResult(victim, spellInfo);
3573 }
3574
3575 return SPELL_MISS_NONE;
3576}
@ SPELL_AURA_REFLECT_SPELLS
Definition: SpellAuraDefines.h:91
@ SPELL_EFFECT_DISPEL
Definition: SharedDefines.h:788
@ SPELL_MISS_IMMUNE
Definition: SharedDefines.h:1498
@ SPELL_MISS_EVADE
Definition: SharedDefines.h:1497
@ SPELL_MISS_REFLECT
Definition: SharedDefines.h:1502
SpellMissInfo MagicSpellHitResult(Unit *victim, SpellInfo const *spell)
Definition: Unit.cpp:3281
SpellMissInfo MeleeSpellHitResult(Unit *victim, SpellInfo const *spell)
Definition: Unit.cpp:3108
uint32 DmgClass
Definition: SpellInfo.h:387

References SpellInfo::DmgClass, EFFECT_0, SpellInfo::Effects, GetAuraEffectsByType(), Spell::GetSpellInfo(), Spell::GetSpellSchoolMask(), GetTotalAuraModifier(), Object::GetTypeId(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), SpellInfo::HasEffect(), Creature::IsEvadingAttacks(), IsHostileTo(), IsImmunedToSchool(), IsImmunedToSpell(), SpellInfo::IsPositive(), MagicSpellHitResult(), MAX_SPELL_EFFECTS, MeleeSpellHitResult(), roll_chance_i(), SPELL_ATTR0_CU_IGNORE_EVADE, SPELL_AURA_CONTROL_VEHICLE, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_REFLECT_SPELLS, SPELL_AURA_REFLECT_SPELLS_SCHOOL, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELL_EFFECT_DISPEL, SPELL_EFFECT_SCHOOL_DAMAGE, SPELL_MISS_EVADE, SPELL_MISS_IMMUNE, SPELL_MISS_NONE, SPELL_MISS_REFLECT, SpellInfo::SpellFamilyName, Object::ToCreature(), and TYPEID_UNIT.

◆ SpellHitResult() [2/2]

SpellMissInfo Unit::SpellHitResult ( Unit victim,
SpellInfo const *  spell,
bool  canReflect = false 
)
3425{
3426 // Check for immune
3427 if (victim->IsImmunedToSpell(spell))
3428 return SPELL_MISS_IMMUNE;
3429
3430 // All positive spells can`t miss
3431 // TODO: client not show miss log for this spells - so need find info for this in dbc and use it!
3432 if ((spell->IsPositive() || spell->HasEffect(SPELL_EFFECT_DISPEL))
3433 && (!IsHostileTo(victim))) // prevent from affecting enemy by "positive" spell
3434 return SPELL_MISS_NONE;
3435
3436 // Check for immune
3437 // xinef: check for school immunity only
3438 if (victim->IsImmunedToSchool(spell))
3439 return SPELL_MISS_IMMUNE;
3440
3441 if (this == victim)
3442 return SPELL_MISS_NONE;
3443
3444 // Return evade for units in evade mode
3445 if (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsEvadingAttacks() && !spell->HasAura(SPELL_AURA_CONTROL_VEHICLE) && !spell->HasAttribute(SPELL_ATTR0_CU_IGNORE_EVADE))
3446 return SPELL_MISS_EVADE;
3447
3448 // Try victim reflect spell
3449 if (CanReflect)
3450 {
3451 int32 reflectchance = victim->GetTotalAuraModifier(SPELL_AURA_REFLECT_SPELLS);
3452 Unit::AuraEffectList const& mReflectSpellsSchool = victim->GetAuraEffectsByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL);
3453 for (Unit::AuraEffectList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i)
3454 if ((*i)->GetMiscValue() & spell->GetSchoolMask())
3455 reflectchance += (*i)->GetAmount();
3456 if (reflectchance > 0 && roll_chance_i(reflectchance))
3457 {
3458 // Start triggers for remove charges if need (trigger only for victim, and mark as active spell)
3459 //ProcDamageAndSpell(victim, PROC_FLAG_NONE, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG, PROC_EX_REFLECT, 1, BASE_ATTACK, spell);
3460 return SPELL_MISS_REFLECT;
3461 }
3462 }
3463
3464 switch (spell->DmgClass)
3465 {
3468 return MeleeSpellHitResult(victim, spell);
3470 {
3471 if (spell->SpellFamilyName)
3472 {
3473 return SPELL_MISS_NONE;
3474 }
3475 // Xinef: apply DAMAGE_CLASS_MAGIC conditions to damaging DAMAGE_CLASS_NONE spells
3476 for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i)
3477 if (spell->Effects[i].Effect && spell->Effects[i].Effect != SPELL_EFFECT_SCHOOL_DAMAGE)
3478 if (spell->Effects[i].ApplyAuraName != SPELL_AURA_PERIODIC_DAMAGE)
3479 return SPELL_MISS_NONE;
3480 [[fallthrough]];
3481 }
3483 return MagicSpellHitResult(victim, spell);
3484 }
3485 return SPELL_MISS_NONE;
3486}

References SpellInfo::DmgClass, EFFECT_0, SpellInfo::Effects, GetAuraEffectsByType(), SpellInfo::GetSchoolMask(), GetTotalAuraModifier(), Object::GetTypeId(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), SpellInfo::HasEffect(), Creature::IsEvadingAttacks(), IsHostileTo(), IsImmunedToSchool(), IsImmunedToSpell(), SpellInfo::IsPositive(), MagicSpellHitResult(), MAX_SPELL_EFFECTS, MeleeSpellHitResult(), roll_chance_i(), SPELL_ATTR0_CU_IGNORE_EVADE, SPELL_AURA_CONTROL_VEHICLE, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_REFLECT_SPELLS, SPELL_AURA_REFLECT_SPELLS_SCHOOL, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELL_EFFECT_DISPEL, SPELL_EFFECT_SCHOOL_DAMAGE, SPELL_MISS_EVADE, SPELL_MISS_IMMUNE, SPELL_MISS_NONE, SPELL_MISS_REFLECT, SpellInfo::SpellFamilyName, Object::ToCreature(), and TYPEID_UNIT.

Referenced by Spell::AddUnitTarget(), DealMeleeDamage(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), and AuraEffect::HandlePeriodicManaLeechAuraTick().

◆ SpellPctDamageModsDone()

float Unit::SpellPctDamageModsDone ( Unit victim,
SpellInfo const *  spellProto,
DamageEffectType  damagetype 
)
11241{
11242 if (!spellProto || !victim || damagetype == DIRECT_DAMAGE)
11243 return 1.0f;
11244
11245 // Some spells don't benefit from done mods
11246 if (spellProto->HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS))
11247 return 1.0f;
11248
11249 // For totems get damage bonus from owner
11250 if (GetTypeId() == TYPEID_UNIT)
11251 {
11252 if (IsTotem())
11253 {
11254 if (Unit* owner = GetOwner())
11255 return owner->SpellPctDamageModsDone(victim, spellProto, damagetype);
11256 }
11257 // Dancing Rune Weapon...
11258 else if (GetEntry() == 27893)
11259 {
11260 if (Unit* owner = GetOwner())
11261 return owner->SpellPctDamageModsDone(victim, spellProto, damagetype);
11262 }
11263 }
11264
11265 // Done total percent damage auras
11266 float DoneTotalMod = 1.0f;
11267
11269 for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
11270 {
11271 // prevent apply mods from weapon specific case to non weapon specific spells (Example: thunder clap and two-handed weapon specialization)
11272 if (spellProto->EquippedItemClass == -1 && (*i)->GetSpellInfo()->EquippedItemClass != -1 &&
11273 !(*i)->GetSpellInfo()->HasAttribute(SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPED_ITEM) && (*i)->GetMiscValue() == SPELL_SCHOOL_MASK_NORMAL)
11274 {
11275 continue;
11276 }
11277
11278 if (!spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT))
11279 continue;
11280
11281 if (!sScriptMgr->IsNeedModSpellDamagePercent(this, *i, DoneTotalMod, spellProto))
11282 continue;
11283
11284 if ((*i)->GetMiscValue() & spellProto->GetSchoolMask())
11285 {
11286 if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
11287 AddPct(DoneTotalMod, (*i)->GetAmount());
11288 else if (!(*i)->GetSpellInfo()->HasAttribute(SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPED_ITEM) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0))
11289 AddPct(DoneTotalMod, (*i)->GetAmount());
11290 else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
11291 AddPct(DoneTotalMod, (*i)->GetAmount());
11292 }
11293 }
11294
11295 uint32 creatureTypeMask = victim->GetCreatureTypeMask();
11297 for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i)
11298 if ((creatureTypeMask & uint32((*i)->GetMiscValue())) && spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT))
11299 AddPct(DoneTotalMod, (*i)->GetAmount());
11300
11301 // bonus against aurastate
11303 for (AuraEffectList::const_iterator i = mDamageDoneVersusAurastate.begin(); i != mDamageDoneVersusAurastate.end(); ++i)
11304 if (victim->HasAuraState(AuraStateType((*i)->GetMiscValue())) && spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT))
11305 AddPct(DoneTotalMod, (*i)->GetAmount());
11306
11307 // done scripted mod (take it from owner)
11308 Unit* owner = GetOwner() ? GetOwner() : this;
11309 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
11310 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
11311 {
11312 // Xinef: self cast is ommited (because of Rage of Rivendare)
11313 if (!spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT))
11314 continue;
11315
11316 // xinef: Molten Fury should work on all spells
11317 switch ((*i)->GetMiscValue())
11318 {
11319 case 4920: // Molten Fury
11320 case 4919:
11321 if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
11322 AddPct(DoneTotalMod, (*i)->GetAmount());
11323 break;
11324 }
11325
11326 if (!(*i)->IsAffectedOnSpell(spellProto))
11327 continue;
11328
11329 switch ((*i)->GetMiscValue())
11330 {
11331 case 6917: // Death's Embrace
11332 case 6926:
11333 case 6928:
11334 {
11335 if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
11336 AddPct(DoneTotalMod, (*i)->GetAmount());
11337 break;
11338 }
11339 // Soul Siphon
11340 case 4992:
11341 case 4993:
11342 {
11343 // effect 1 m_amount
11344 int32 maxPercent = (*i)->GetAmount();
11345 // effect 0 m_amount
11346 int32 stepPercent = CalculateSpellDamage(this, (*i)->GetSpellInfo(), 0);
11347 // count affliction effects and calc additional damage in percentage
11348 int32 modPercent = 0;
11349 AuraApplicationMap const& victimAuras = victim->GetAppliedAuras();
11350 for (AuraApplicationMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr)
11351 {
11352 Aura const* aura = itr->second->GetBase();
11353 SpellInfo const* m_spell = aura->GetSpellInfo();
11354 if (m_spell->SpellFamilyName != SPELLFAMILY_WARLOCK || !(m_spell->SpellFamilyFlags[1] & 0x0004071B || m_spell->SpellFamilyFlags[0] & 0x8044C402))
11355 continue;
11356 modPercent += stepPercent * aura->GetStackAmount();
11357 if (modPercent >= maxPercent)
11358 {
11359 modPercent = maxPercent;
11360 break;
11361 }
11362 }
11363 AddPct(DoneTotalMod, modPercent);
11364 break;
11365 }
11366 case 6916: // Death's Embrace
11367 case 6925:
11368 case 6927:
11369 if (HasAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, spellProto, this))
11370 AddPct(DoneTotalMod, (*i)->GetAmount());
11371 break;
11372 case 5481: // Starfire Bonus
11373 {
11374 if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x200002, 0, 0))
11375 AddPct(DoneTotalMod, (*i)->GetAmount());
11376 break;
11377 }
11378 // Tundra Stalker
11379 // Merciless Combat
11380 case 7277:
11381 {
11382 // Merciless Combat
11383 if ((*i)->GetSpellInfo()->SpellIconID == 2656)
11384 {
11385 if( (spellProto && spellProto->SpellFamilyFlags[0] & 0x2) || spellProto->SpellFamilyFlags[1] & 0x2 )
11386 if (!victim->HealthAbovePct(35))
11387 AddPct(DoneTotalMod, (*i)->GetAmount());
11388 }
11389 // Tundra Stalker
11390 else
11391 {
11392 // Frost Fever (target debuff)
11393 if (victim->HasAura(55095))
11394 AddPct(DoneTotalMod, (*i)->GetAmount());
11395 break;
11396 }
11397 break;
11398 }
11399 // Rage of Rivendare
11400 case 7293:
11401 {
11403 AddPct(DoneTotalMod, (*i)->GetSpellInfo()->GetRank() * 2.0f);
11404 break;
11405 }
11406 // Twisted Faith
11407 case 7377:
11408 {
11410 AddPct(DoneTotalMod, (*i)->GetAmount());
11411 break;
11412 }
11413 // Marked for Death
11414 case 7598:
11415 case 7599:
11416 case 7600:
11417 case 7601:
11418 case 7602:
11419 {
11420 if (victim->GetAuraEffect(SPELL_AURA_MOD_STALKED, SPELLFAMILY_HUNTER, 0x400, 0, 0))
11421 AddPct(DoneTotalMod, (*i)->GetAmount());
11422 break;
11423 }
11424 // Dirty Deeds
11425 case 6427:
11426 case 6428:
11427 case 6579:
11428 case 6580:
11429 {
11430 if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
11431 {
11432 // effect 0 has expected value but in negative state
11433 int32 bonus = -(*i)->GetBase()->GetEffect(0)->GetAmount();
11434 AddPct(DoneTotalMod, bonus);
11435 }
11436 break;
11437 }
11438 }
11439 }
11440
11441 // Custom scripted damage
11442 switch (spellProto->SpellFamilyName)
11443 {
11444 case SPELLFAMILY_MAGE:
11445 // Ice Lance
11446 if (spellProto->SpellIconID == 186)
11447 {
11448 if (victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this))
11449 {
11450 // Glyph of Ice Lance
11451 if (owner->HasAura(56377) && victim->GetLevel() > owner->GetLevel())
11452 DoneTotalMod *= 4.0f;
11453 else
11454 DoneTotalMod *= 3.0f;
11455 }
11456 }
11457
11458 // Torment the weak
11459 if (spellProto->SpellFamilyFlags[0] & 0x20600021 || spellProto->SpellFamilyFlags[1] & 0x9000)
11460 if (victim->HasAuraWithMechanic((1 << MECHANIC_SNARE) | (1 << MECHANIC_SLOW_ATTACK)))
11462 AddPct(DoneTotalMod, aurEff->GetAmount());
11463 break;
11464 case SPELLFAMILY_PRIEST:
11465 // Mind Flay
11466 if (spellProto->SpellFamilyFlags[0] & 0x800000)
11467 {
11468 // Glyph of Shadow Word: Pain
11469 if (AuraEffect* aurEff = GetAuraEffect(55687, 0))
11470 // Increase Mind Flay damage if Shadow Word: Pain present on target
11472 AddPct(DoneTotalMod, aurEff->GetAmount());
11473
11474 // Twisted Faith - Mind Flay part
11476 // Increase Mind Flay damage if Shadow Word: Pain present on target
11478 AddPct(DoneTotalMod, aurEff->GetAmount());
11479 }
11480 // Smite
11481 else if (spellProto->SpellFamilyFlags[0] & 0x80)
11482 {
11483 // Glyph of Smite
11484 if (AuraEffect* aurEff = GetAuraEffect(55692, 0))
11485 if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x100000, 0, 0, GetGUID()))
11486 AddPct(DoneTotalMod, aurEff->GetAmount());
11487 }
11488 // Shadow Word: Death
11489 else if (spellProto->SpellFamilyFlags[1] & 0x2)
11490 {
11491 // Glyph of Shadow Word: Death
11492 if (AuraEffect* aurEff = GetAuraEffect(55682, 1))
11494 AddPct(DoneTotalMod, aurEff->GetAmount());
11495 }
11496
11497 break;
11499 // Judgement of Vengeance/Judgement of Corruption
11500 if ((spellProto->SpellFamilyFlags[1] & 0x400000) && spellProto->SpellIconID == 2292)
11501 {
11502 // Get stack of Holy Vengeance/Blood Corruption on the target added by caster
11503 uint32 stacks = 0;
11505 for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
11506 if (((*itr)->GetId() == 31803 || (*itr)->GetId() == 53742) && (*itr)->GetCasterGUID() == GetGUID())
11507 {
11508 stacks = (*itr)->GetBase()->GetStackAmount();
11509 break;
11510 }
11511 // + 10% for each application of Holy Vengeance/Blood Corruption on the target
11512 if (stacks)
11513 AddPct(DoneTotalMod, 10 * stacks);
11514 }
11515 break;
11516 case SPELLFAMILY_DRUID:
11517 // Thorns
11518 if (spellProto->SpellFamilyFlags[0] & 0x100)
11519 {
11520 // Brambles
11521 if (AuraEffect* aurEff = GetAuraEffectOfRankedSpell(16836, 0))
11522 AddPct(DoneTotalMod, aurEff->GetAmount());
11523 }
11524 break;
11526 // Fire and Brimstone
11527 if (spellProto->SpellFamilyFlags[1] & 0x00020040)
11529 {
11531 for (AuraEffectList::const_iterator i = mDumyAuras.begin(); i != mDumyAuras.end(); ++i)
11532 if ((*i)->GetSpellInfo()->SpellIconID == 3173)
11533 {
11534 AddPct(DoneTotalMod, (*i)->GetAmount());
11535 break;
11536 }
11537 }
11538 // Drain Soul - increased damage for targets under 25 % HP
11539 if (spellProto->SpellFamilyFlags[0] & 0x00004000)
11540 if (!victim->HealthAbovePct(25))
11541 DoneTotalMod *= 4;
11542 // Shadow Bite (15% increase from each dot)
11543 if (spellProto->SpellFamilyFlags[1] & 0x00400000 && IsPet())
11544 if (uint8 count = victim->GetDoTsByCaster(GetOwnerGUID()))
11545 AddPct(DoneTotalMod, 15 * count);
11546 break;
11547 case SPELLFAMILY_HUNTER:
11548 // Steady Shot
11549 if (spellProto->SpellFamilyFlags[1] & 0x1)
11550 if (AuraEffect* aurEff = GetAuraEffect(56826, 0)) // Glyph of Steady Shot
11551 if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_HUNTER, 0x00004000, 0, 0, GetGUID()))
11552 AddPct(DoneTotalMod, aurEff->GetAmount());
11553 break;
11555 // Improved Icy Touch
11556 if (spellProto->SpellFamilyFlags[0] & 0x2)
11558 AddPct(DoneTotalMod, aurEff->GetAmount());
11559
11560 // Glacier Rot
11561 if (spellProto->SpellFamilyFlags[0] & 0x2 || spellProto->SpellFamilyFlags[1] & 0x6)
11563 if (victim->GetDiseasesByCaster(owner->GetGUID()) > 0)
11564 AddPct(DoneTotalMod, aurEff->GetAmount());
11565 break;
11566 }
11567
11568 return DoneTotalMod;
11569}
@ MECHANIC_SLOW_ATTACK
Definition: SharedDefines.h:1305
@ AURA_STATE_HEALTHLESS_20_PERCENT
Definition: SharedDefines.h:1265
uint32 GetDiseasesByCaster(ObjectGuid casterGUID, uint8 mode=0)
Definition: Unit.cpp:5733
bool HasAuraWithMechanic(uint32 mechanicMask) const
Definition: Unit.cpp:5704
AuraEffect * GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:5426
uint32 GetDoTsByCaster(ObjectGuid casterGUID) const
Definition: Unit.cpp:5779

References AddPct(), AURA_STATE_CONFLAGRATE, AURA_STATE_FROZEN, AURA_STATE_HEALTHLESS_20_PERCENT, AURA_STATE_HEALTHLESS_35_PERCENT, CalculateSpellDamage(), DIRECT_DAMAGE, DOT, EFFECT_0, SpellInfo::EquippedItemClass, GetAppliedAuras(), GetAuraEffect(), GetAuraEffectOfRankedSpell(), GetAuraEffectsByType(), GetCreatureTypeMask(), GetDiseasesByCaster(), GetDoTsByCaster(), GetDummyAuraEffect(), Object::GetEntry(), Object::GetGUID(), GetLevel(), GetOwner(), GetOwnerGUID(), SpellInfo::GetSchoolMask(), Aura::GetSpellInfo(), Aura::GetStackAmount(), Object::GetTypeId(), SpellInfo::HasAttribute(), HasAura(), HasAuraState(), HasAuraWithMechanic(), HealthAbovePct(), IsPet(), IsTotem(), MECHANIC_SLOW_ATTACK, MECHANIC_SNARE, SPELL_ATTR3_IGNORE_CASTER_MODIFIERS, SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPED_ITEM, SPELL_AURA_DUMMY, SPELL_AURA_MOD_DAMAGE_DONE_VERSUS, SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, SPELL_AURA_MOD_STALKED, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_DRUID, SPELLFAMILY_GENERIC, SPELLFAMILY_HUNTER, SPELLFAMILY_MAGE, SPELLFAMILY_PALADIN, SPELLFAMILY_PRIEST, SPELLFAMILY_WARLOCK, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, sScriptMgr, Object::ToPlayer(), TYPEID_UNIT, and SpellInfo::ValidateAttribute6SpellDamageMods().

Referenced by AuraEffect::CalculatePeriodicData(), and SpellDamageBonusDone().

◆ SpellPctHealingModsDone()

float Unit::SpellPctHealingModsDone ( Unit victim,
SpellInfo const *  spellProto,
DamageEffectType  damagetype 
)
12284{
12285 // For totems get healing bonus from owner (statue isn't totem in fact)
12286 if (GetTypeId() == TYPEID_UNIT && IsTotem())
12287 if (Unit* owner = GetOwner())
12288 return owner->SpellPctHealingModsDone(victim, spellProto, damagetype);
12289
12290 // Some spells don't benefit from done mods
12291 if (spellProto->HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS))
12292 return 1.0f;
12293
12294 // xinef: Some spells don't benefit from done mods
12295 if (spellProto->HasAttribute(SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS))
12296 return 1.0f;
12297
12298 // No bonus healing for potion spells
12299 if (spellProto->SpellFamilyName == SPELLFAMILY_POTION)
12300 return 1.0f;
12301
12302 float DoneTotalMod = 1.0f;
12303
12304 // Healing done percent
12306 for (auto const& auraEff : mHealingDonePct)
12307 {
12308 if (!sScriptMgr->IsNeedModHealPercent(this, auraEff, DoneTotalMod, spellProto))
12309 continue;
12310
12311 AddPct(DoneTotalMod, auraEff->GetAmount());
12312 }
12313
12314 // done scripted mod (take it from owner)
12315 Unit* owner = GetOwner() ? GetOwner() : this;
12316 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
12317 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
12318 {
12319 if (!(*i)->IsAffectedOnSpell(spellProto))
12320 continue;
12321
12322 switch ((*i)->GetMiscValue())
12323 {
12324 case 21: // Test of Faith
12325 case 6935:
12326 case 6918:
12327 if (victim->HealthBelowPct(50))
12328 AddPct(DoneTotalMod, (*i)->GetAmount());
12329 break;
12330 case 7798: // Glyph of Regrowth
12331 {
12333 AddPct(DoneTotalMod, (*i)->GetAmount());
12334 break;
12335 }
12336
12337 case 7871: // Glyph of Lesser Healing Wave
12338 {
12339 // xinef: affected by any earth shield
12340 if (victim->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0, 0x00000400, 0))
12341 AddPct(DoneTotalMod, (*i)->GetAmount());
12342 break;
12343 }
12344 default:
12345 break;
12346 }
12347 }
12348
12349 switch (spellProto->SpellFamilyName)
12350 {
12352 // Talents and glyphs for healing stream totem
12353 if (spellProto->Id == 52042)
12354 {
12355 // Glyph of Healing Stream Totem
12356 if (AuraEffect* dummy = owner->GetAuraEffect(55456, EFFECT_0))
12357 AddPct(DoneTotalMod, dummy->GetAmount());
12358
12359 // Healing Stream totem - Restorative Totems
12360 if (AuraEffect* aurEff = GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 338, 1))
12361 AddPct(DoneTotalMod, aurEff->GetAmount());
12362 }
12363 break;
12364 case SPELLFAMILY_PRIEST:
12365 // T9 HEALING 4P, empowered renew instant heal
12366 if (spellProto->Id == 63544)
12367 if (AuraEffect* aurEff = GetAuraEffect(67202, EFFECT_0))
12368 AddPct(DoneTotalMod, aurEff->GetAmount());
12369 break;
12370 }
12371
12372 return DoneTotalMod;
12373}
@ SPELL_AURA_MOD_HEALING_DONE_PERCENT
Definition: SpellAuraDefines.h:199

References AddPct(), EFFECT_0, GetAuraEffect(), GetAuraEffectsByType(), GetDummyAuraEffect(), GetOwner(), Object::GetTypeId(), SpellInfo::HasAttribute(), HealthBelowPct(), SpellInfo::Id, IsTotem(), SPELL_ATTR3_IGNORE_CASTER_MODIFIERS, SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS, SPELL_AURA_DUMMY, SPELL_AURA_MOD_HEALING_DONE_PERCENT, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, SPELLFAMILY_GENERIC, SPELLFAMILY_POTION, SPELLFAMILY_PRIEST, SPELLFAMILY_SHAMAN, SpellInfo::SpellFamilyName, sScriptMgr, and TYPEID_UNIT.

Referenced by AuraEffect::CalculatePeriodicData(), and SpellHealingBonusDone().

◆ SpellTakenCritChance()

float Unit::SpellTakenCritChance ( Unit const *  caster,
SpellInfo const *  spellProto,
SpellSchoolMask  schoolMask,
float  doneChance,
WeaponAttackType  attackType,
bool  skipEffectCheck 
) const
11993{
11994 // not critting spell
11995 if (spellProto->HasAttribute(SPELL_ATTR2_CANT_CRIT))
11996 return 0.0f;
11997
11998 // Xinef: check if spell is capable of critting, auras requires special aura to crit so they can be skipped
11999 if (!skipEffectCheck && !spellProto->IsCritCapable())
12000 return 0.0f;
12001
12002 float crit_chance = doneChance;
12003 switch (spellProto->DmgClass)
12004 {
12006 {
12007 if (!spellProto->IsPositive())
12008 {
12009 // Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE
12010 // xinef: apply max and min only
12012 {
12015 }
12016
12017 Unit::ApplyResilience(this, &crit_chance, nullptr, false, CR_CRIT_TAKEN_SPELL);
12018 }
12019 // scripted (increase crit chance ... against ... target by x%
12020 if (caster)
12021 {
12022 AuraEffectList const& mOverrideClassScript = caster->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
12023 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
12024 {
12025 if (!((*i)->IsAffectedOnSpell(spellProto)))
12026 continue;
12027 int32 modChance = 0;
12028 switch ((*i)->GetMiscValue())
12029 {
12030 // Shatter
12031 case 911:
12032 modChance += 16;
12033 [[fallthrough]];
12034 case 910:
12035 modChance += 17;
12036 [[fallthrough]];
12037 case 849:
12038 modChance += 17;
12039 if (!HasAuraState(AURA_STATE_FROZEN, spellProto, caster))
12040 break;
12041 crit_chance += modChance;
12042 break;
12043 case 7917: // Glyph of Shadowburn
12044 if (HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, caster))
12045 crit_chance += (*i)->GetAmount();
12046 break;
12047 case 7997: // Renewed Hope
12048 case 7998:
12049 if (HasAura(6788))
12050 crit_chance += (*i)->GetAmount();
12051 break;
12052 default:
12053 break;
12054 }
12055 }
12056 // Custom crit by class
12057 switch (spellProto->SpellFamilyName)
12058 {
12059 case SPELLFAMILY_MAGE:
12060 // Glyph of Fire Blast
12061 if (spellProto->SpellFamilyFlags[0] == 0x2 && spellProto->SpellIconID == 12)
12063 if (AuraEffect const* aurEff = caster->GetAuraEffect(56369, EFFECT_0))
12064 crit_chance += aurEff->GetAmount();
12065 break;
12066 case SPELLFAMILY_DRUID:
12067 // Improved Faerie Fire
12069 if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 109, 0))
12070 crit_chance += aurEff->GetAmount();
12071
12072 // cumulative effect - don't break
12073
12074 // Starfire
12075 if (spellProto->SpellFamilyFlags[0] & 0x4 && spellProto->SpellIconID == 1485)
12076 {
12077 // Improved Insect Swarm
12078 if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 1771, 0))
12080 crit_chance += aurEff->GetAmount();
12081 break;
12082 }
12083 break;
12084 case SPELLFAMILY_ROGUE:
12085 // Shiv-applied poisons can't crit
12086 if (caster->FindCurrentSpellBySpellId(5938))
12087 crit_chance = 0.0f;
12088 break;
12090 // Flash of light
12091 if (spellProto->SpellFamilyFlags[0] & 0x40000000)
12092 {
12093 // Sacred Shield
12094 if (AuraEffect const* aura = GetAuraEffect(58597, 1, GetGUID()))
12095 crit_chance += aura->GetAmount();
12096 break;
12097 }
12098 // Exorcism
12099 else if (spellProto->GetCategory() == 19)
12100 {
12102 return 100.0f;
12103 break;
12104 }
12105 break;
12106 case SPELLFAMILY_SHAMAN:
12107 // Lava Burst
12108 if (spellProto->SpellFamilyFlags[1] & 0x00001000)
12109 {
12110 if (GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 0x10000000, 0, 0, caster->GetGUID()))
12112 return 100.0f;
12113 break;
12114 }
12115 break;
12116 }
12117 }
12118 break;
12119 }
12121 // Custom crit by class
12122 if (caster)
12123 {
12124 switch (spellProto->SpellFamilyName)
12125 {
12126 case SPELLFAMILY_DRUID:
12127 // Rend and Tear - bonus crit chance for Ferocious Bite on bleeding targets
12128 if (spellProto->SpellFamilyFlags[0] & 0x00800000 && spellProto->SpellIconID == 1680 && HasAuraState(AURA_STATE_BLEEDING))
12129 {
12130 if (AuraEffect const* rendAndTear = caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 2859, 1))
12131 crit_chance += rendAndTear->GetAmount();
12132 break;
12133 }
12134 break;
12136 // Victory Rush
12137 if (spellProto->SpellFamilyFlags[1] & 0x100)
12138 {
12139 // Glyph of Victory Rush
12140 if (AuraEffect const* aurEff = caster->GetAuraEffect(58382, 0))
12141 crit_chance += aurEff->GetAmount();
12142 break;
12143 }
12144 break;
12145 }
12146 }
12147
12148 // 100% critical chance against sitting target
12150 {
12151 return 100.0f;
12152 }
12153 [[fallthrough]]; // TODO: Not sure whether the fallthrough was a mistake (forgetting a break) or intended. This should be double-checked.
12155 {
12156 // flat aura mods
12157 if (attackType == RANGED_ATTACK)
12159 else
12161
12162 // reduce crit chance from Rating for players
12163 if (attackType != RANGED_ATTACK)
12164 {
12165 // xinef: little hack, crit chance dont require caster to calculate, pass victim
12166 Unit::ApplyResilience(this, &crit_chance, nullptr, false, CR_CRIT_TAKEN_MELEE);
12167 }
12168 else
12169 Unit::ApplyResilience(this, &crit_chance, nullptr, false, CR_CRIT_TAKEN_RANGED);
12170
12171 // Apply crit chance from defence skill
12172 if (caster)
12173 crit_chance += (int32(caster->GetMaxSkillValueForLevel(this)) - int32(GetDefenseSkillValue(caster))) * 0.04f;
12174
12175 break;
12176 }
12177 // values overridden in spellmgr for lifebloom and earth shield
12179 default:
12180 return 0.0f;
12181 }
12182
12183 if (caster)
12184 {
12186 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
12187 {
12188 if (caster->GetGUID() != (*i)->GetCasterGUID())
12189 continue;
12190
12191 crit_chance += (*i)->GetAmount();
12192 }
12193 }
12194
12195 // Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE
12196 // xinef: should be calculated at the end
12197 if (!spellProto->IsPositive())
12199
12200 // xinef: can be negative!
12201 return crit_chance;
12202}
@ SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE
Definition: SpellAuraDefines.h:242
uint32 const CREATURE_TYPEMASK_DEMON_OR_UNDEAD
Definition: SharedDefines.h:2615
@ MECHANIC_KNOCKOUT
Definition: SharedDefines.h:1311
@ AURA_STATE_BLEEDING
Definition: SharedDefines.h:1282
int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask, const AuraEffect *except=nullptr) const
Definition: Unit.cpp:5898
int32 GetMaxNegativeAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition: Unit.cpp:5912

References ApplyResilience(), AURA_STATE_BLEEDING, AURA_STATE_FAERIE_FIRE, AURA_STATE_FROZEN, AURA_STATE_HEALTHLESS_35_PERCENT, CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, CR_CRIT_TAKEN_SPELL, CREATURE_TYPEMASK_DEMON_OR_UNDEAD, SpellInfo::DmgClass, EFFECT_0, FindCurrentSpellBySpellId(), GetAuraEffect(), GetAuraEffectsByType(), SpellInfo::GetCategory(), GetCreatureTypeMask(), GetDefenseSkillValue(), GetDummyAuraEffect(), Object::GetGUID(), GetMaxNegativeAuraModifierByMiscMask(), GetMaxPositiveAuraModifierByMiscMask(), GetMaxSkillValueForLevel(), getStandState(), GetTotalAuraModifier(), Object::GetTypeId(), SpellInfo::HasAttribute(), HasAura(), HasAuraState(), HasAuraType(), HasAuraWithMechanic(), SpellInfo::IsCritCapable(), SpellInfo::IsPositive(), IsSitState(), MECHANIC_KNOCKOUT, MECHANIC_STUN, RANGED_ATTACK, SPELL_ATTR2_CANT_CRIT, SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE, SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELLFAMILY_DRUID, SPELLFAMILY_MAGE, SPELLFAMILY_PALADIN, SPELLFAMILY_ROGUE, SPELLFAMILY_SHAMAN, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, TYPEID_PLAYER, and UNIT_STAND_STATE_SLEEP.

Referenced by AuraEffect::CalcPeriodicCritChance(), and Spell::DoAllEffectOnLaunchTarget().

◆ StartReactiveTimer()

void Unit::StartReactiveTimer ( ReactiveType  reactive)
inline
#define REACTIVE_TIMER_START
Definition: Unit.h:1198

References m_reactiveTimer, and REACTIVE_TIMER_START.

Referenced by ProcDamageAndSpellFor().

◆ StopAttackFaction()

void Unit::StopAttackFaction ( uint32  faction_id)
20295{
20296 if (Unit* victim = GetVictim())
20297 {
20298 if (victim->GetFactionTemplateEntry()->faction == faction_id)
20299 {
20300 AttackStop();
20301 if (IsNonMeleeSpellCast(false))
20303
20304 // melee and ranged forced attack cancel
20305 if (GetTypeId() == TYPEID_PLAYER)
20307 }
20308 }
20309
20310 AttackerSet const& attackers = getAttackers();
20311 for (AttackerSet::const_iterator itr = attackers.begin(); itr != attackers.end();)
20312 {
20313 if ((*itr)->GetFactionTemplateEntry()->faction == faction_id)
20314 {
20315 (*itr)->AttackStop();
20316 itr = attackers.begin();
20317 }
20318 else
20319 ++itr;
20320 }
20321
20323
20324 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
20325 (*itr)->StopAttackFaction(faction_id);
20326}
void deleteReferencesForFaction(uint32 faction)
Definition: HostileRefMgr.cpp:162

References AttackStop(), HostileRefMgr::deleteReferencesForFaction(), getAttackers(), getHostileRefMgr(), Object::GetTypeId(), GetVictim(), InterruptNonMeleeSpells(), IsNonMeleeSpellCast(), m_Controlled, Player::SendAttackSwingCancelAttack(), Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by AuraEffect::HandleForceReaction().

◆ StopAttackingInvalidTarget()

void Unit::StopAttackingInvalidTarget ( )
20329{
20330 AttackerSet const& attackers = getAttackers();
20331 for (AttackerSet::const_iterator itr = attackers.begin(); itr != attackers.end();)
20332 {
20333 Unit* attacker = (*itr);
20334 if (!attacker->IsValidAttackTarget(this))
20335 {
20336 attacker->AttackStop();
20337 if (attacker->GetTypeId() == TYPEID_PLAYER)
20338 {
20340 }
20341
20342 for (Unit* controled : attacker->m_Controlled)
20343 {
20344 if (controled->GetVictim() == this && !controled->IsValidAttackTarget(this))
20345 {
20346 controled->AttackStop();
20347 }
20348 }
20349
20350 itr = attackers.begin();
20351 }
20352 else
20353 {
20354 ++itr;
20355 }
20356 }
20357}

References AttackStop(), getAttackers(), Object::GetTypeId(), GetVictim(), IsValidAttackTarget(), m_Controlled, Player::SendAttackSwingCancelAttack(), Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by RemoveCharmedBy(), and SetCharmedBy().

◆ StopMoving()

void Unit::StopMoving ( )
16799{
16801
16802 // not need send any packets if not in world or not moving
16803 if (!IsInWorld())
16804 return;
16805
16806 if (movespline->Finalized())
16807 return;
16808
16809 // Update position now since Stop does not start a new movement that can be updated later
16810 if (movespline->HasStarted())
16812
16813 Movement::MoveSplineInit init(this);
16814 init.Stop();
16815}
void UpdateSplinePosition()
Definition: Unit.cpp:626
bool HasStarted() const
Definition: MoveSpline.h:129

References ClearUnitState(), Movement::MoveSpline::Finalized(), Movement::MoveSpline::HasStarted(), Object::IsInWorld(), movespline, Movement::MoveSplineInit::Stop(), UNIT_STATE_MOVING, and UpdateSplinePosition().

Referenced by npc_escortAI::AttackStart(), SmartAI::AttackStart(), boss_baron_geddon::boss_baron_geddonAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::DamageTaken(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), npc_kinetic_bomb::npc_kinetic_bombAI::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), ScriptedAI::DoCastSpell(), FlightPathMovementGenerator::DoFinalize(), FleeingMovementGenerator< T >::DoFinalize(), ConfusedMovementGenerator< T >::DoFinalize(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), ChaseMovementGenerator< T >::DoInitialize(), WaypointMovementGenerator< Creature >::DoUpdate(), RandomMovementGenerator< T >::DoUpdate(), ChaseMovementGenerator< T >::DoUpdate(), FollowMovementGenerator< T >::DoUpdate(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), debug_commandscript::HandleDebugMoveflagsCommand(), WorldSession::HandlePetActionHelper(), RotateMovementGenerator::Initialize(), npc_bone_spike::npc_bone_spikeAI::IsSummonedBy(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), boss_kologarn::boss_kologarnAI::JustDied(), Player::LeaveBattleground(), boss_headless_horseman::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), boss_ghazan::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), PauseMovement(), SmartAI::PausePath(), npc_hidden_cultist::npc_hidden_cultistAI::PreScript(), RemoveCharmedBy(), Creature::RemoveCorpse(), npc_xt002_scrapbot::npc_xt002_scrapbotAI::Reset(), npc_xt002_boombot::npc_xt002_boombotAI::Reset(), IdleMovementGenerator::Reset(), npc_putricide_oozeAI::SelectNewTarget(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), SetCharmedBy(), SmartAI::SetCombatMove(), SetConfused(), boss_victor_nefarius::boss_victor_nefariusAI::SetData(), setDeathState(), SetFeared(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), SetRooted(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), npc_tirion_fordring_tft::npc_tirion_fordringAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), npc_vengeful_shade::npc_vengeful_shadeAI::SpellHitTarget(), boss_heigan::boss_heiganAI::StartFightPhase(), SmartAI::StopFollow(), SmartAI::StopPath(), CreatureAI::TriggerAlert(), Pet::Update(), TimedFleeingMovementGenerator::Update(), boss_felblood_kaelthas::boss_felblood_kaelthasAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_akilzon::boss_akilzonAI::UpdateAI(), boss_janalai::boss_janalaiAI::UpdateAI(), npc_frost_wyrm::npc_frost_wyrmAI::UpdateAI(), npc_gargoyle::npc_gargoyleAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_valithria_cloud::npc_valithria_cloudAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_thorim_sif::boss_thorim_sifAI::UpdateAI(), boss_leotheras_the_blind::boss_leotheras_the_blindAI::UpdateAI(), boss_alar::boss_alarAI::UpdateAI(), boss_kaelthas::boss_kaelthasAI::UpdateAI(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::UpdateAI(), npc_pet_gen_plump_turkey::UpdateAI(), and PetAI::UpdateAI().

◆ StopMovingOnCurrentPos()

void Unit::StopMovingOnCurrentPos ( )
16838{
16840
16841 // not need send any packets if not in world
16842 if (!IsInWorld())
16843 return;
16844
16845 DisableSpline(); // pussywizard: required so Launch() won't recalculate position from previous spline
16846 Movement::MoveSplineInit init(this);
16847 init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ());
16848 init.SetFacing(GetOrientation());
16849 init.Launch();
16850}

References ClearUnitState(), DisableSpline(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Object::IsInWorld(), Movement::MoveSplineInit::Launch(), Movement::MoveSplineInit::MoveTo(), Movement::MoveSplineInit::SetFacing(), and UNIT_STATE_MOVING.

Referenced by npc_mograine::npc_mograineAI::AshbringerEvent(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), UtherBatteredHiltEvent::Execute(), WorldSession::HandlePetActionHelper(), boss_flame_leviathan::boss_flame_leviathanAI::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), boss_cyanigosa::boss_cyanigosaAI::JustDied(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustSummoned(), boss_icehowl::boss_icehowlAI::MovementInform(), npc_escortAI::MovementInform(), SmartAI::MovepointReached(), npc_ulduar_magnetic_core::npc_ulduar_magnetic_coreAI::npc_ulduar_magnetic_coreAI(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_ulduar::instance_ulduar_InstanceMapScript::OnCreatureCreate(), boss_skadi::boss_skadiAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), SetRooted(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::SpawnAdds(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), Creature::Update(), npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_janalai::boss_janalaiAI::UpdateAI(), boss_jormungarAI::UpdateAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), npc_vortex_ride::npc_vortex_rideAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_alar::boss_alarAI::UpdateAI(), and boss_high_astromancer_solarian::boss_high_astromancer_solarianAI::UpdateAI().

◆ Talk() [1/2]

void Unit::Talk ( std::string_view  text,
ChatMsg  msgType,
Language  language,
float  textRange,
WorldObject const *  target 
)
virtual
21257{
21258 Acore::CustomChatTextBuilder builder(this, msgType, text, language, target);
21261 Cell::VisitWorldObjects(this, worker, textRange);
21262}
static void VisitWorldObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:193
Definition: GridNotifiers.h:589
Definition: GridNotifiers.h:1703
Definition: ChatTextBuilder.h:49

References Cell::VisitWorldObjects().

◆ Talk() [2/2]

void Unit::Talk ( uint32  textId,
ChatMsg  msgType,
float  textRange,
WorldObject const *  target 
)
virtual
21293{
21294 if (!sObjectMgr->GetBroadcastText(textId))
21295 {
21296 LOG_ERROR("entities.unit", "Unit::Talk: `broadcast_text` (ID: {}) was not found", textId);
21297 return;
21298 }
21299
21300 Acore::BroadcastTextBuilder builder(this, msgType, textId, getGender(), target);
21303 Cell::VisitWorldObjects(this, worker, textRange);
21304}
Definition: ChatTextBuilder.h:31

References getGender(), LOG_ERROR, sObjectMgr, and Cell::VisitWorldObjects().

◆ TauntApply()

void Unit::TauntApply ( Unit victim)
14555{
14557
14558 if (!taunter || (taunter->GetTypeId() == TYPEID_PLAYER && taunter->ToPlayer()->IsGameMaster()))
14559 return;
14560
14561 if (!CanHaveThreatList())
14562 return;
14563
14564 Creature* creature = ToCreature();
14565
14566 if (creature->HasReactState(REACT_PASSIVE))
14567 return;
14568
14569 Unit* target = GetVictim();
14570 if (target && target == taunter)
14571 return;
14572
14573 SetInFront(taunter);
14574 if (creature->IsAIEnabled)
14575 creature->AI()->AttackStart(taunter);
14576
14577 //m_ThreatMgr.tauntApply(taunter);
14578}
void SetInFront(WorldObject const *target)
Definition: Unit.cpp:20734

References Creature::AI(), ASSERT, UnitAI::AttackStart(), CanHaveThreatList(), Object::GetTypeId(), GetVictim(), Creature::HasReactState(), IsAIEnabled, Player::IsGameMaster(), REACT_PASSIVE, SetInFront(), Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, and TYPEID_UNIT.

Referenced by AuraEffect::HandleModTaunt(), boss_razorgore::boss_razorgoreAI::OnCharmed(), and boss_murmur::boss_murmurAI::UpdateAI().

◆ TauntFadeOut()

void Unit::TauntFadeOut ( Unit taunter)
14583{
14585
14586 if (!taunter || (taunter->GetTypeId() == TYPEID_PLAYER && taunter->ToPlayer()->IsGameMaster()))
14587 return;
14588
14589 if (!CanHaveThreatList())
14590 return;
14591
14592 Creature* creature = ToCreature();
14593
14594 if (creature->HasReactState(REACT_PASSIVE))
14595 return;
14596
14597 Unit* target = GetVictim();
14598 if (!target || target != taunter)
14599 return;
14600
14602 {
14603 if (creature->IsAIEnabled)
14605 return;
14606 }
14607
14608 target = creature->SelectVictim(); // might have more taunt auras remaining
14609
14610 if (target && target != taunter)
14611 {
14612 SetInFront(target);
14613 if (creature->IsAIEnabled)
14614 creature->AI()->AttackStart(target);
14615 }
14616}
@ EVADE_REASON_NO_HOSTILES
Definition: CreatureAI.h:88
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Definition: CreatureAI.cpp:180
bool isThreatListEmpty() const
Definition: ThreatMgr.h:225
Unit * SelectVictim()
Definition: Unit.cpp:14620

References Creature::AI(), ASSERT, UnitAI::AttackStart(), CanHaveThreatList(), CreatureAI::EnterEvadeMode(), CreatureAI::EVADE_REASON_NO_HOSTILES, Object::GetTypeId(), GetVictim(), Creature::HasReactState(), IsAIEnabled, Player::IsGameMaster(), ThreatMgr::isThreatListEmpty(), m_ThreatMgr, REACT_PASSIVE, Creature::SelectVictim(), SetInFront(), Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, and TYPEID_UNIT.

Referenced by AuraEffect::HandleModTaunt(), and npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::UpdateAI().

◆ TextEmote() [1/2]

void Unit::TextEmote ( std::string_view  text,
WorldObject const *  target = nullptr,
bool  isBossEmote = false 
)
virtual

Reimplemented in Player.

21275{
21277}
@ CONFIG_LISTEN_RANGE_TEXTEMOTE
Definition: IWorld.h:191
@ CHAT_MSG_RAID_BOSS_EMOTE
Definition: SharedDefines.h:3165
@ CHAT_MSG_MONSTER_EMOTE
Definition: SharedDefines.h:3140

References CHAT_MSG_MONSTER_EMOTE, CHAT_MSG_RAID_BOSS_EMOTE, CONFIG_LISTEN_RANGE_TEXTEMOTE, LANG_UNIVERSAL, and sWorld.

Referenced by boss_renataki::boss_renatakiAI::DamageTaken(), boss_huhuran::DamageTaken(), Spell::EffectScriptEffect(), npc_commandscript::HandleNpcTextEmoteCommand(), spell_the_flag_of_ownership::HandleScript(), spell_item_worn_troll_dice::HandleScript(), npc_image_of_medivh::npc_image_of_medivhAI::NextStep(), Map::ScriptsProcess(), boss_grand_champion::boss_grand_championAI::SpellHit(), npc_artorius::npc_artoriusAI::SpellHit(), npc_simone::npc_simoneAI::SpellHit(), npc_nelson::npc_nelsonAI::SpellHit(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::SpreadFire(), npc_finklestein::npc_finklesteinAI::StartNextTask(), boss_headless_horseman_head::UpdateAI(), boss_eadric::boss_eadricAI::UpdateAI(), boss_yoggsaron::boss_yoggsaronAI::UpdateAI(), boss_archavon::boss_archavonAI::UpdateAI(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), and npc_frosthound::npc_frosthoundAI::WaypointReached().

◆ TextEmote() [2/2]

void Unit::TextEmote ( uint32  textId,
WorldObject const *  target = nullptr,
bool  isBossEmote = false 
)
virtual

Reimplemented in Player.

21317{
21318 Talk(textId, isBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), target);
21319}

References CHAT_MSG_MONSTER_EMOTE, CHAT_MSG_RAID_BOSS_EMOTE, CONFIG_LISTEN_RANGE_TEXTEMOTE, and sWorld.

◆ ToPet()

◆ ToTempSummon() [1/2]

TempSummon * Unit::ToTempSummon ( )
inline
2400{ if (IsSummon()) return reinterpret_cast<TempSummon*>(this); else return nullptr; }

References IsSummon().

Referenced by _ExitVehicle(), npc_living_mojo::npc_living_mojoAI::AttackStart(), WorldObject::CanSeeOrDetect(), Spell::CheckCast(), Spell::CheckEffectTarget(), npc_your_inner_turmoil::npc_your_inner_turmoilAI::DamageTaken(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), Creature::DespawnOnEvade(), Creature::DespawnOrUnsummon(), npc_bone_spike::npc_bone_spikeAI::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::DoAction(), ThreatMgr::DoAddThreat(), Spell::EffectScriptEffect(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::EnterCombat(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::EnterCombat(), npc_phantom_hallucination::npc_phantom_hallucinationAI::EnterEvadeMode(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::EnterEvadeMode(), SuckBackEvent::Execute(), boss_headless_horseman_head::GetOwner(), GetSpellModOwner(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::GetSummoner(), SmartScript::GetTargets(), WorldSession::HandleDismissCritter(), spell_pilgrims_bounty_pass_generic::HandleDummy(), WorldSession::HandlePetActionHelper(), spell_pri_lightwell::HandleScriptEffect(), spell_q11026_a11051_banish_the_demons::HandleScriptEffect(), npc_hourglass_of_eternity::npc_hourglass_of_eternityAI::InitializeAI(), npc_bushwhacker::npc_bushwhackerAI::InitializeAI(), npc_pet_gen_imp_in_a_bottle::InitializeAI(), npc_pet_pri_lightwell::InitializeAI(), TempSummon::InitStats(), SpellClickInfo::IsFitToRequirements(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::JustDied(), boss_black_knight::boss_black_knightAI::JustDied(), boss_tyrannus::boss_tyrannusAI::JustDied(), npc_raging_spirit::npc_raging_spiritAI::JustDied(), boss_freya_iron_root::boss_freya_iron_rootAI::JustDied(), boss_yoggsaron_influence_tentacle::boss_yoggsaron_influence_tentacleAI::JustDied(), npc_counselor_talbot::npc_counselor_talbotAI::JustDied(), npc_your_inner_turmoil::npc_your_inner_turmoilAI::JustDied(), boss_essence_of_anger::boss_essence_of_angerAI::JustDied(), npc_pet_dk_ghoul::npc_pet_dk_ghoulAI::JustDied(), npc_pet_pri_shadowfiend::JustDied(), boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::JustSummoned(), npc_frosthound::npc_frosthoundAI::JustSummoned(), boss_halion::boss_halionAI::JustSummoned(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustSummoned(), npc_collapsing_star::npc_collapsing_starAI::JustSummoned(), npc_algalon_worm_hole::npc_algalon_worm_holeAI::JustSummoned(), boss_supremus::boss_supremusAI::JustSummoned(), Kill(), npc_tiger_matriarch::npc_tiger_matriarchAI::KilledUnit(), npc_living_mojo::npc_living_mojoAI::MoveInLineOfSight(), npc_frostbrood_skytalon::npc_frostbrood_skytalonAI::MovementInform(), npc_leryssa::npc_leryssaAI::MovementInform(), boss_attumen::boss_attumenAI::MovementInform(), boss_attumen_midnight::boss_attumen_midnightAI::MovementInform(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::MovementInform(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::MovementInform(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::npc_attracted_reef_bullAI(), npc_claw_tentacle::npc_claw_tentacle(), npc_eye_tentacle::npc_eye_tentacle(), npc_frost_tomb::npc_frost_tombAI::npc_frost_tombAI(), npc_giant_claw_tentacle::npc_giant_claw_tentacle(), npc_giant_eye_tentacle::npc_giant_eye_tentacle(), npc_pet_gen_soul_trader_beacon::npc_pet_gen_soul_trader_beacon(), BattlefieldWG::OnCreatureCreate(), instance_blackwing_lair::instance_blackwing_lair_InstanceMapScript::OnCreatureCreate(), npc_wormhole::OnGossipHello(), RemoveAllControlled(), RemoveAllMinionsByEntry(), spell_gen_defend::RemoveDummyFromDriver(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::Reset(), npc_raging_spirit::npc_raging_spiritAI::Reset(), npc_stormforged_lieutenant::npc_stormforged_lieutenantAI::Reset(), npc_future_you::npc_future_youAI::Reset(), npc_plaguehound_tracker::npc_plaguehound_trackerAI::Reset(), npc_pet_gen_argent_pony_bridle::Reset(), Spell::SelectImplicitCasterObjectTargets(), Creature::SelectVictim(), Spell::SendSpellGo(), Spell::SendSpellStart(), npc_your_inner_turmoil::npc_your_inner_turmoilAI::setphase(), npc_ulduar_flames_spread::npc_ulduar_flames_spreadAI::SpellHit(), npc_pilgrims_bounty_plate::SpellHit(), boss_the_lich_king::boss_the_lich_kingAI::SummonedCreatureDies(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), npc_love_in_air_snivel_real::UpdateAI(), npc_tiger_matriarch_credit::npc_tiger_matriarch_creditAI::UpdateAI(), npc_tiger_matriarch::npc_tiger_matriarchAI::UpdateAI(), npc_living_mojo::npc_living_mojoAI::UpdateAI(), npc_bone_spike::npc_bone_spikeAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), npc_freya_ward::npc_freya_wardAI::UpdateAI(), npc_ulduar_flash_freeze::npc_ulduar_flash_freezeAI::UpdateAI(), npc_vh_void_sentry::npc_vh_void_sentryAI::UpdateAI(), npc_captured_beryl_sorcerer::npc_captured_beryl_sorcererAI::UpdateAI(), npc_feedin_da_goolz::npc_feedin_da_goolzAI::UpdateAI(), Player::VehicleSpellInitialize(), and npc_frosthound::npc_frosthoundAI::WaypointReached().

◆ ToTempSummon() [2/2]

const TempSummon * Unit::ToTempSummon ( ) const
inline
2401{ if (IsSummon()) return reinterpret_cast<const TempSummon*>(this); else return nullptr; }

References IsSummon().

◆ ToTotem()

Totem * Unit::ToTotem ( )
inline
2399{ if (IsTotem()) return reinterpret_cast<Totem*>(this); else return nullptr; }
Definition: Totem.h:43

References IsTotem().

Referenced by _UnapplyAura(), Spell::EffectDestroyAllTotems(), WorldSession::HandleTotemDestroyed(), SetMinion(), Spell::SummonGuardian(), and TotemAI::UpdateAI().

◆ TriggerAurasProcOnEvent() [1/3]

void Unit::TriggerAurasProcOnEvent ( CalcDamageInfo damageInfo)
16692{
16693 DamageInfo dmgInfo = DamageInfo(damageInfo);
16694 TriggerAurasProcOnEvent(nullptr, nullptr, damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, 0, 0, damageInfo.procEx, nullptr, &dmgInfo, nullptr);
16695}
void TriggerAurasProcOnEvent(CalcDamageInfo &damageInfo)
Definition: Unit.cpp:16691

References CalcDamageInfo::procAttacker, CalcDamageInfo::procEx, CalcDamageInfo::procVictim, CalcDamageInfo::target, and TriggerAurasProcOnEvent().

Referenced by TriggerAurasProcOnEvent().

◆ TriggerAurasProcOnEvent() [2/3]

void Unit::TriggerAurasProcOnEvent ( ProcEventInfo eventInfo,
std::list< AuraApplication * > &  procAuras 
)
16717{
16718 for (std::list<AuraApplication*>::iterator itr = aurasTriggeringProc.begin(); itr != aurasTriggeringProc.end(); ++itr)
16719 {
16720 if (!(*itr)->GetRemoveMode())
16721 (*itr)->GetBase()->TriggerProcOnEvent(*itr, eventInfo);
16722 }
16723}

◆ TriggerAurasProcOnEvent() [3/3]

void Unit::TriggerAurasProcOnEvent ( std::list< AuraApplication * > *  myProcAuras,
std::list< AuraApplication * > *  targetProcAuras,
Unit actionTarget,
uint32  typeMaskActor,
uint32  typeMaskActionTarget,
uint32  spellTypeMask,
uint32  spellPhaseMask,
uint32  hitMask,
Spell spell,
DamageInfo damageInfo,
HealInfo healInfo 
)
16698{
16699 // prepare data for self trigger
16700 ProcEventInfo myProcEventInfo = ProcEventInfo(this, actionTarget, actionTarget, typeMaskActor, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo);
16701 std::list<AuraApplication*> myAurasTriggeringProc;
16702 GetProcAurasTriggeredOnEvent(myAurasTriggeringProc, myProcAuras, myProcEventInfo);
16703
16704 // prepare data for target trigger
16705 ProcEventInfo targetProcEventInfo = ProcEventInfo(this, actionTarget, this, typeMaskActionTarget, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo);
16706 std::list<AuraApplication*> targetAurasTriggeringProc;
16707 if (typeMaskActionTarget)
16708 GetProcAurasTriggeredOnEvent(targetAurasTriggeringProc, targetProcAuras, targetProcEventInfo);
16709
16710 TriggerAurasProcOnEvent(myProcEventInfo, myAurasTriggeringProc);
16711
16712 if (typeMaskActionTarget)
16713 TriggerAurasProcOnEvent(targetProcEventInfo, targetAurasTriggeringProc);
16714}
void GetProcAurasTriggeredOnEvent(std::list< AuraApplication * > &aurasTriggeringProc, std::list< AuraApplication * > *procAuras, ProcEventInfo eventInfo)
Definition: Unit.cpp:16661

References GetProcAurasTriggeredOnEvent(), and TriggerAurasProcOnEvent().

◆ UnsummonAllTotems()

void Unit::UnsummonAllTotems ( bool  onDeath = false)
11166{
11167 for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
11168 {
11169 if (!m_SummonSlot[i])
11170 {
11171 continue;
11172 }
11173
11174 if (Creature* OldTotem = GetMap()->GetCreature(m_SummonSlot[i]))
11175 {
11176 if (OldTotem->IsSummon())
11177 {
11178 if (!(onDeath && !IsPlayer() && OldTotem->IsGuardian()))
11179 {
11180 OldTotem->ToTempSummon()->UnSummon();
11181 }
11182 }
11183 }
11184 }
11185}

References WorldObject::GetMap(), Object::IsPlayer(), m_SummonSlot, and MAX_SUMMON_SLOT.

Referenced by Player::ActivateSpec(), RemoveFromWorld(), and setDeathState().

◆ Update()

void Unit::Update ( uint32  time)
overridevirtual

Reimplemented from WorldObject.

404{
405 sScriptMgr->OnUnitUpdate(this, p_time);
406
407 // WARNING! Order of execution here is important, do not change.
408 // Spells must be processed with event system BEFORE they go to _UpdateSpells.
409 // Or else we may have some SPELL_STATE_FINISHED spells stalled in pointers, that is bad.
410 m_Events.Update(p_time);
411
412 if (!IsInWorld())
413 return;
414
415 // pussywizard:
416 if (GetTypeId() != TYPEID_PLAYER || (!ToPlayer()->IsBeingTeleported() && !bRequestForcedVisibilityUpdate))
417 {
419 {
421 {
423 //ExecuteDelayedUnitRelocationEvent();
425 }
426 else
428 }
430 {
431 if (m_delayed_unit_ai_notify_timer <= p_time)
432 {
435 }
436 else
438 }
439 }
440
441 _UpdateSpells( p_time );
442
443 if (CanHaveThreatList() && GetThreatMgr().isNeedUpdateToClient(p_time))
445
446 // update combat timer only for players and pets (only pets with PetAI)
448 {
449 // Check UNIT_STATE_MELEE_ATTACKING or UNIT_STATE_CHASE (without UNIT_STATE_FOLLOW in this case) so pets can reach far away
450 // targets without stopping half way there and running off.
451 // These flags are reset after target dies or another command is given.
453 {
454 // m_CombatTimer set at aura start and it will be freeze until aura removing
455 if (m_CombatTimer <= p_time)
457 else
458 m_CombatTimer -= p_time;
459 }
460 }
461
464 {
465 while (!extraAttacksTargets.empty())
466 {
467 auto itr = extraAttacksTargets.begin();
468 ObjectGuid targetGuid = itr->first;
469 uint32 count = itr->second;
470 extraAttacksTargets.erase(itr);
471 if (Unit* victim = ObjectAccessor::GetUnit(*this, targetGuid))
472 {
474 || victim->IsWithinMeleeRange(this))
475 {
476 HandleProcExtraAttackFor(victim, count);
477 }
478 }
479 }
481 }
482
483 // not implemented before 3.0.2
484 // xinef: if attack time > 0, reduce by diff
485 // if on next update, attack time < 0 assume player didnt attack - set to 0
486 bool suspendAttackTimer = false;
487 bool suspendRangedAttackTimer = false;
489 {
490 for (Spell* spell : m_currentSpells)
491 {
492 if (spell)
493 {
494 if (spell->GetSpellInfo()->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS))
495 {
496 if (spell->IsChannelActive())
497 {
498 suspendRangedAttackTimer = true;
499 }
500
501 suspendAttackTimer = true;
502 break;
503 }
504 }
505 }
506 }
507
508 if (!suspendAttackTimer)
509 {
510 if (int32 base_attack = getAttackTimer(BASE_ATTACK))
511 {
512 setAttackTimer(BASE_ATTACK, base_attack > 0 ? base_attack - (int32) p_time : 0);
513 }
514
515 if (int32 off_attack = getAttackTimer(OFF_ATTACK))
516 {
517 setAttackTimer(OFF_ATTACK, off_attack > 0 ? off_attack - (int32) p_time : 0);
518 }
519 }
520
521 if (!suspendRangedAttackTimer)
522 {
523 if (int32 ranged_attack = getAttackTimer(RANGED_ATTACK))
524 {
525 setAttackTimer(RANGED_ATTACK, ranged_attack > 0 ? ranged_attack - (int32)p_time : 0);
526 }
527 }
528
529 // update abilities available only for fraction of time
530 UpdateReactives(p_time);
531
535
536 UpdateSplineMovement(p_time);
537 GetMotionMaster()->UpdateMotion(p_time);
538}
@ AURA_STATE_HEALTH_ABOVE_75_PERCENT
Definition: SharedDefines.h:1287
bool IsEmpty() const
Definition: LinkedList.h:97
void Update(uint32 p_time)
Definition: EventProcessor.cpp:40
void _UpdateSpells(uint32 time)
Definition: Unit.cpp:3797
void UpdateSplineMovement(uint32 t_diff)
Definition: Unit.cpp:594
void UpdateReactives(uint32 p_time)
Definition: Unit.cpp:17085
void ExecuteDelayedUnitAINotifyEvent()
Definition: Unit.cpp:20723
void HandleProcExtraAttackFor(Unit *victim, uint32 count)
Definition: Unit.cpp:2718
void SendThreatListUpdate()
Definition: Unit.cpp:20205
std::unordered_set< Unit * > i_objectsForDelayedVisibility
Definition: Map.h:388
void UpdateMotion(uint32 diff)
Definition: MotionMaster.cpp:103

References _lastDamagedTargetGuid, _lastExtraAttackSpell, _UpdateSpells(), AURA_STATE_HEALTH_ABOVE_75_PERCENT, AURA_STATE_HEALTHLESS_20_PERCENT, AURA_STATE_HEALTHLESS_35_PERCENT, BASE_ATTACK, bRequestForcedVisibilityUpdate, CanHaveThreatList(), ClearInCombat(), ObjectGuid::Empty, ExecuteDelayedUnitAINotifyEvent(), extraAttacksTargets, WorldObject::FindMap(), getAttackTimer(), GetMotionMaster(), GetThreatMgr(), Object::GetTypeId(), ObjectAccessor::GetUnit(), HandleProcExtraAttackFor(), HasUnitState(), HasUnitTypeMask(), HealthAbovePct(), HealthBelowPct(), Map::i_objectsForDelayedVisibility, IsAlive(), IsControlledByPlayer(), LinkedListHead::IsEmpty(), IsInCombat(), Object::IsInWorld(), IsPet(), Object::IsPlayer(), m_CombatTimer, m_currentSpells, m_delayed_unit_ai_notify_timer, m_delayed_unit_relocation_timer, m_Events, m_HostileRefMgr, ModifyAuraState(), OFF_ATTACK, RANGED_ATTACK, SendThreatListUpdate(), setAttackTimer(), SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS, SPELL_HACK_AND_SLASH, SPELL_SWORD_SPECIALIZATION, sScriptMgr, Object::ToPlayer(), TYPEID_PLAYER, UNIT_MASK_CONTROLABLE_GUARDIAN, UNIT_STATE_CASTING, EventProcessor::Update(), MotionMaster::UpdateMotion(), UpdateReactives(), and UpdateSplineMovement().

Referenced by Creature::Update(), and Player::Update().

◆ UpdateAllResistances()

void Unit::UpdateAllResistances ( )
virtual

◆ UpdateAllStats()

virtual bool Unit::UpdateAllStats ( )
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

◆ UpdateArmor()

virtual void Unit::UpdateArmor ( )
pure virtual

◆ UpdateAttackPowerAndDamage()

virtual void Unit::UpdateAttackPowerAndDamage ( bool  ranged = false)
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

Referenced by HandleStatModifier().

◆ UpdateAuraForGroup()

void Unit::UpdateAuraForGroup ( uint8  slot)
17315{
17316 if (slot >= MAX_AURAS) // slot not found, return
17317 return;
17318 if (Player* player = ToPlayer())
17319 {
17320 if (player->GetGroup())
17321 {
17322 player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_AURAS);
17323 player->SetAuraUpdateMaskForRaid(slot);
17324 }
17325 }
17326 else if (GetTypeId() == TYPEID_UNIT && IsPet())
17327 {
17328 Pet* pet = ((Pet*)this);
17329 if (pet->isControlled())
17330 {
17331 Unit* owner = GetOwner();
17332 if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && owner->ToPlayer()->GetGroup())
17333 {
17335 pet->SetAuraUpdateMaskForRaid(slot);
17336 }
17337 }
17338 }
17339}
@ GROUP_UPDATE_FLAG_PET_AURAS
Definition: Group.h:117
@ GROUP_UPDATE_FLAG_AURAS
Definition: Group.h:108
#define MAX_AURAS
Definition: SpellAuraDefines.h:21
void SetAuraUpdateMaskForRaid(uint8 slot)
Definition: Pet.h:136

References Player::GetGroup(), GetOwner(), Object::GetTypeId(), GROUP_UPDATE_FLAG_AURAS, GROUP_UPDATE_FLAG_PET_AURAS, Pet::isControlled(), IsPet(), MAX_AURAS, Pet::SetAuraUpdateMaskForRaid(), Player::SetGroupUpdateFlag(), Object::ToPlayer(), TYPEID_PLAYER, and TYPEID_UNIT.

Referenced by RemoveVisibleAura(), and SetVisibleAura().

◆ UpdateCharmAI()

void Unit::UpdateCharmAI ( )
15673{
15674 if (GetTypeId() == TYPEID_PLAYER)
15675 return;
15676
15677 if (i_disabledAI) // disabled AI must be primary AI
15678 {
15679 if (!IsCharmed())
15680 {
15681 delete i_AI;
15683 i_disabledAI = nullptr;
15684 }
15685 }
15686 else
15687 {
15688 if (IsCharmed())
15689 {
15691 if (isPossessed() || IsVehicle())
15692 i_AI = new PossessedAI(ToCreature());
15693 else
15694 i_AI = new PetAI(ToCreature());
15695 }
15696 }
15697}
Definition: PassiveAI.h:37
Definition: PetAI.h:47

References Object::GetTypeId(), i_AI, i_disabledAI, IsCharmed(), isPossessed(), IsVehicle(), Object::ToCreature(), and TYPEID_PLAYER.

Referenced by Creature::Update().

◆ UpdateDamagePhysical()

void Unit::UpdateDamagePhysical ( WeaponAttackType  attType)
virtual

Reimplemented in Guardian, and Totem.

61{
62 float totalMin = 0.f;
63 float totalMax = 0.f;
64
65 float tmpMin, tmpMax;
66 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
67 {
68 CalculateMinMaxDamage(attType, false, true, tmpMin, tmpMax, i);
69 totalMin += tmpMin;
70 totalMax += tmpMax;
71 }
72
73 switch (attType)
74 {
75 case BASE_ATTACK:
76 default:
79 break;
80 case OFF_ATTACK:
83 break;
84 case RANGED_ATTACK:
87 break;
88 }
89}
void SetStatFloatValue(uint16 index, float value)
Definition: Object.cpp:790

References BASE_ATTACK, CalculateMinMaxDamage(), MAX_ITEM_PROTO_DAMAGES, OFF_ATTACK, RANGED_ATTACK, Object::SetStatFloatValue(), UNIT_FIELD_MAXDAMAGE, UNIT_FIELD_MAXOFFHANDDAMAGE, UNIT_FIELD_MAXRANGEDDAMAGE, UNIT_FIELD_MINDAMAGE, UNIT_FIELD_MINOFFHANDDAMAGE, and UNIT_FIELD_MINRANGEDDAMAGE.

Referenced by Player::_ApplyAmmoBonuses(), Player::_ApplyWeaponDamage(), boss_twin_valkyrAI::boss_twin_valkyrAI(), AuraEffect::HandleAuraModDisarm(), AuraEffect::HandleModAttackSpeed(), HandleStatModifier(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::npc_toc_enh_shamanAI(), Player::RemoveAmmo(), Creature::SetCanDualWield(), Creature::UpdateAttackPowerAndDamage(), and Player::UpdateAttackPowerAndDamage().

◆ UpdateHeight()

void Unit::UpdateHeight ( float  newZ)

Only server-side height update, does not broadcast to client.

20199{
20201 if (IsVehicle())
20203}
void RelocatePassengers()
Definition: Vehicle.cpp:502

References Position::GetPositionX(), Position::GetPositionY(), GetVehicleKit(), IsVehicle(), Position::Relocate(), and Vehicle::RelocatePassengers().

Referenced by npc_dancing_flames::npc_dancing_flamesAI::Reset(), and SetHover().

◆ UpdateInterruptMask()

void Unit::UpdateInterruptMask ( )
760{
761 m_interruptMask = 0;
762 for (AuraApplicationList::const_iterator i = m_interruptableAuras.begin(); i != m_interruptableAuras.end(); ++i)
763 m_interruptMask |= (*i)->GetBase()->GetSpellInfo()->AuraInterruptFlags;
764
766 if (spell->getState() == SPELL_STATE_CASTING)
767 m_interruptMask |= spell->m_spellInfo->ChannelInterruptFlags;
768}

References CURRENT_CHANNELED_SPELL, m_currentSpells, m_interruptableAuras, m_interruptMask, and SPELL_STATE_CASTING.

Referenced by _UnapplyAura(), Spell::finish(), and RemoveAurasWithInterruptFlags().

◆ UpdateMaxHealth()

virtual void Unit::UpdateMaxHealth ( )
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

Referenced by HandleStatModifier().

◆ UpdateMaxPower()

virtual void Unit::UpdateMaxPower ( Powers  power)
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

Referenced by HandleStatModifier().

◆ UpdateObjectVisibility()

◆ UpdateOrientation()

void Unit::UpdateOrientation ( float  orientation)

Only server-side orientation update, does not broadcast to client.

20191{
20192 SetOrientation(orientation);
20193 if (IsVehicle())
20195}

References GetVehicleKit(), IsVehicle(), Vehicle::RelocatePassengers(), and Position::SetOrientation().

Referenced by Spell::UpdateChanneledTargetList(), and UpdatePosition().

◆ UpdatePosition() [1/2]

bool Unit::UpdatePosition ( const Position pos,
bool  teleport = false 
)
inline

◆ UpdatePosition() [2/2]

bool Unit::UpdatePosition ( float  x,
float  y,
float  z,
float  ang,
bool  teleport = false 
)
virtual

Reimplemented in Player.

20153{
20154 if (!Acore::IsValidMapCoord(x, y, z, orientation))
20155 return false;
20156
20157 float old_orientation = GetOrientation();
20158 float current_z = GetPositionZ();
20159 bool turn = (old_orientation != orientation);
20160 bool relocated = (teleport || GetPositionX() != x || GetPositionY() != y || current_z != z);
20161
20162 if (!GetVehicle())
20163 {
20164 uint32 mask = 0;
20165 if (turn) mask |= AURA_INTERRUPT_FLAG_TURNING;
20166 if (relocated) mask |= AURA_INTERRUPT_FLAG_MOVE;
20167 if (mask)
20169 }
20170
20171 if (relocated)
20172 {
20173 if (GetTypeId() == TYPEID_PLAYER)
20174 GetMap()->PlayerRelocation(ToPlayer(), x, y, z, orientation);
20175 else
20176 GetMap()->CreatureRelocation(ToCreature(), x, y, z, orientation);
20177 }
20178 else if (turn)
20179 {
20180 UpdateOrientation(orientation);
20181
20182 if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetFarSightDistance())
20184 }
20185
20186 return (relocated || turn);
20187}
bool IsValidMapCoord(float c)
Definition: GridDefines.h:216
void UpdateOrientation(float orientation)
Only server-side orientation update, does not broadcast to client.
Definition: Unit.cpp:20190
void PlayerRelocation(Player *, float x, float y, float z, float o)
Definition: Map.cpp:1003
void CreatureRelocation(Creature *creature, float x, float y, float z, float o)
Definition: Map.cpp:1025

References AURA_INTERRUPT_FLAG_MOVE, AURA_INTERRUPT_FLAG_TURNING, Map::CreatureRelocation(), WorldObject::GetMap(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Object::GetTypeId(), GetVehicle(), Acore::IsValidMapCoord(), Map::PlayerRelocation(), RemoveAurasWithInterruptFlags(), Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, UpdateObjectVisibility(), and UpdateOrientation().

Referenced by npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), boss_taldaram::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::EnterEvadeMode(), UtherBatteredHiltEvent::Execute(), WorldSession::HandleMovementOpcodes(), WorldSession::HandleMoveRootAck(), WorldSession::HandleMoveUnRootAck(), boss_flame_leviathan::boss_flame_leviathanAI::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), boss_cyanigosa::boss_cyanigosaAI::JustDied(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustSummoned(), boss_harbinger_skyriss::boss_harbinger_skyrissAI::JustSummoned(), boss_icehowl::boss_icehowlAI::MovementInform(), NearTeleportTo(), npc_ulduar_magnetic_core::npc_ulduar_magnetic_coreAI::npc_ulduar_magnetic_coreAI(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::Reposition(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::Reposition(), boss_skadi::boss_skadiAI::Reset(), npc_imprisoned_beryl_sorcerer::npc_imprisoned_beryl_sorcererAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), npc_escortAI::SetNextWaypoint(), npc_your_inner_turmoil::npc_your_inner_turmoilAI::setphase(), npc_frost_sphere::npc_frost_sphereAI::UpdateAI(), boss_jormungarAI::UpdateAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), npc_vortex_ride::npc_vortex_rideAI::UpdateAI(), boss_flame_leviathan::boss_flame_leviathanAI::UpdateAI(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::UpdateAI(), Player::UpdatePosition(), and UpdateSplinePosition().

◆ UpdateReactives()

void Unit::UpdateReactives ( uint32  p_time)
17086{
17087 for (uint8 i = 0; i < MAX_REACTIVE; ++i)
17088 {
17089 ReactiveType reactive = ReactiveType(i);
17090
17091 if (!m_reactiveTimer[reactive])
17092 continue;
17093
17094 if (m_reactiveTimer[reactive] <= p_time)
17095 {
17096 m_reactiveTimer[reactive] = 0;
17097
17098 switch (reactive)
17099 {
17100 case REACTIVE_DEFENSE:
17103 break;
17107 break;
17108 case REACTIVE_OVERPOWER:
17109 if (getClass() == CLASS_WARRIOR)
17110 {
17112 }
17113 break;
17115 if (IsHunterPet())
17117 break;
17118 default:
17119 break;
17120 }
17121 }
17122 else
17123 {
17124 m_reactiveTimer[reactive] -= p_time;
17125 }
17126 }
17127}
ReactiveType
Definition: Unit.h:1201

References AURA_STATE_DEFENSE, AURA_STATE_HUNTER_PARRY, CLASS_HUNTER, CLASS_WARRIOR, ClearComboPoints(), getClass(), HasAuraState(), IsHunterPet(), m_reactiveTimer, MAX_REACTIVE, ModifyAuraState(), REACTIVE_DEFENSE, REACTIVE_HUNTER_PARRY, REACTIVE_OVERPOWER, and REACTIVE_WOLVERINE_BITE.

Referenced by Update().

◆ UpdateResistances()

virtual void Unit::UpdateResistances ( uint32  school)
pure virtual

Implemented in Creature, Player, and Totem.

Referenced by HandleStatModifier(), and UpdateAllResistances().

◆ UpdateSpeed()

void Unit::UpdateSpeed ( UnitMoveType  mtype,
bool  forced 
)
Todo:
possible affect only on MOVE_RUN
14153{
14154 int32 main_speed_mod = 0;
14155 float stack_bonus = 1.0f;
14156 float non_stack_bonus = 1.0f;
14157
14158 switch (mtype)
14159 {
14160 // Only apply debuffs
14161 case MOVE_FLIGHT_BACK:
14162 case MOVE_RUN_BACK:
14163 case MOVE_SWIM_BACK:
14164 case MOVE_WALK:
14165 break;
14166 case MOVE_RUN:
14167 {
14168 if (IsMounted()) // Use on mount auras
14169 {
14173 }
14174 else
14175 {
14179 }
14180 break;
14181 }
14182 case MOVE_SWIM:
14183 {
14184 // xinef: check for forced_speed_mod of sea turtle
14186 for (Unit::AuraEffectList::const_iterator itr = swimAuras.begin(); itr != swimAuras.end(); ++itr)
14187 {
14188 // xinef: sea turtle only, it is not affected by any increasing / decreasing effects
14189 if ((*itr)->GetId() == 64731 /*SPELL_SEA_TURTLE*/)
14190 {
14191 SetSpeed(mtype, AddPct(non_stack_bonus, (*itr)->GetAmount()), forced);
14192 return;
14193 }
14194 else if (
14195 // case: increase speed
14196 ((*itr)->GetAmount() > 0 && (*itr)->GetAmount() > main_speed_mod) ||
14197 // case: decrease speed
14198 ((*itr)->GetAmount() < 0 && (*itr)->GetAmount() < main_speed_mod)
14199 )
14200 {
14201 main_speed_mod = (*itr)->GetAmount();
14202 }
14203 }
14204 break;
14205 }
14206 case MOVE_FLIGHT:
14207 {
14208 if (GetTypeId() == TYPEID_UNIT && IsControlledByPlayer()) // not sure if good for pet
14209 {
14212
14213 // for some spells this mod is applied on vehicle owner
14214 int32 owner_speed_mod = 0;
14215
14216 if (Unit* owner = GetCharmer())
14217 owner_speed_mod = owner->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED);
14218
14219 main_speed_mod = std::max(main_speed_mod, owner_speed_mod);
14220 }
14221 else if (IsMounted())
14222 {
14225 }
14226 else // Use not mount (shapeshift for example) auras (should stack)
14228
14230
14231 // Update speed for vehicle if available
14232 if (GetTypeId() == TYPEID_PLAYER && GetVehicle())
14234 break;
14235 }
14236 default:
14237 LOG_ERROR("entities.unit", "Unit::UpdateSpeed: Unsupported move type ({})", mtype);
14238 return;
14239 }
14240
14241 // now we ready for speed calculation
14242 float speed = std::max(non_stack_bonus, stack_bonus);
14243 if (main_speed_mod)
14244 AddPct(speed, main_speed_mod);
14245
14246 switch (mtype)
14247 {
14248 case MOVE_RUN:
14249 case MOVE_SWIM:
14250 case MOVE_FLIGHT:
14251 {
14252 // Set creature speed rate
14253 if (GetTypeId() == TYPEID_UNIT)
14254 speed *= ToCreature()->GetCreatureTemplate()->speed_run; // at this point, MOVE_WALK is never reached
14255
14256 // Normalize speed by 191 aura SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED if need
14259 {
14260 if (Creature* creature = ToCreature())
14261 {
14262 uint32 immuneMask = creature->GetCreatureTemplate()->MechanicImmuneMask;
14263 if (immuneMask & (1 << (MECHANIC_SNARE - 1)) || immuneMask & (1 << (MECHANIC_DAZE - 1)))
14264 break;
14265 }
14266
14267 // Use speed from aura
14268 float max_speed = normalization / (IsControlledByPlayer() ? playerBaseMoveSpeed[mtype] : baseMoveSpeed[mtype]);
14269 if (speed > max_speed)
14270 speed = max_speed;
14271 }
14272 break;
14273 }
14274 default:
14275 break;
14276 }
14277
14278 int32 slowFromHealth = 0;
14279 Creature* creature = ToCreature();
14280 // ignore pets, player owned vehicles, and mobs immune to snare
14281 if (creature
14282 && !IsPet()
14283 && !(IsControlledByPlayer() && IsVehicle())
14285 && !(creature->IsDungeonBoss()))
14286 {
14287 // 1.6% for each % under 30.
14288 // use min(0, health-30) so that we don't boost mobs above 30.
14289 slowFromHealth = (int32) std::min(0.0f, (1.66f * (GetHealthPct() - 30.0f)));
14290 }
14291
14292 if (slowFromHealth)
14293 {
14294 AddPct(speed, slowFromHealth);
14295 }
14296
14297 // Apply strongest slow aura mod to speed
14299 if (slow)
14300 AddPct(speed, slow);
14301
14302 if (float minSpeedMod = (float)GetMaxPositiveAuraModifier(SPELL_AURA_MOD_MINIMUM_SPEED))
14303 {
14304 float base_speed = (GetTypeId() == TYPEID_UNIT ? ToCreature()->GetCreatureTemplate()->speed_run : 1.0f);
14305 float min_speed = base_speed * (minSpeedMod / 100.0f);
14306 if (speed < min_speed)
14307 speed = min_speed;
14308 }
14309
14310 SetSpeed(mtype, speed, forced);
14311}
@ SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK
Definition: SpellAuraDefines.h:274
@ SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED
Definition: SpellAuraDefines.h:271
@ SPELL_AURA_MOD_MOUNTED_FLIGHT_SPEED_ALWAYS
Definition: SpellAuraDefines.h:272
@ SPELL_AURA_MOD_INCREASE_SPEED
Definition: SpellAuraDefines.h:94
@ SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK
Definition: SpellAuraDefines.h:235
@ SPELL_AURA_MOD_SPEED_NOT_STACK
Definition: SpellAuraDefines.h:234
@ SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED
Definition: SpellAuraDefines.h:269
@ SPELL_AURA_MOD_INCREASE_SWIM_SPEED
Definition: SpellAuraDefines.h:121
@ SPELL_AURA_MOD_VEHICLE_SPEED_ALWAYS
Definition: SpellAuraDefines.h:273
@ SPELL_AURA_MOD_MINIMUM_SPEED
Definition: SpellAuraDefines.h:368
@ SPELL_AURA_MOD_SPEED_ALWAYS
Definition: SpellAuraDefines.h:192
@ SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS
Definition: SpellAuraDefines.h:193
@ SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED
Definition: SpellAuraDefines.h:95
@ SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED
Definition: SpellAuraDefines.h:254
@ MECHANIC_DAZE
Definition: SharedDefines.h:1324
float speed_run
Definition: CreatureData.h:194

References AddPct(), baseMoveSpeed, GetAuraEffectsByType(), GetCharmer(), Creature::GetCreatureTemplate(), GetHealthPct(), GetMaxNegativeAuraModifier(), GetMaxPositiveAuraModifier(), GetTotalAuraModifier(), GetTotalAuraMultiplier(), Object::GetTypeId(), GetVehicle(), GetVehicleBase(), Creature::HasMechanicTemplateImmunity(), IsControlledByPlayer(), Creature::IsDungeonBoss(), IsMounted(), IsPet(), IsVehicle(), LOG_ERROR, MECHANIC_DAZE, MECHANIC_SNARE, MOVE_FLIGHT, MOVE_FLIGHT_BACK, MOVE_RUN, MOVE_RUN_BACK, MOVE_SWIM, MOVE_SWIM_BACK, MOVE_WALK, playerBaseMoveSpeed, SetSpeed(), CreatureTemplate::speed_run, SPELL_AURA_MOD_DECREASE_SPEED, SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK, SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED, SPELL_AURA_MOD_INCREASE_SPEED, SPELL_AURA_MOD_INCREASE_SWIM_SPEED, SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED, SPELL_AURA_MOD_MINIMUM_SPEED, SPELL_AURA_MOD_MOUNTED_FLIGHT_SPEED_ALWAYS, SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS, SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK, SPELL_AURA_MOD_SPEED_ALWAYS, SPELL_AURA_MOD_SPEED_NOT_STACK, SPELL_AURA_MOD_VEHICLE_SPEED_ALWAYS, SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED, Object::ToCreature(), TYPEID_PLAYER, TYPEID_UNIT, and UpdateSpeed().

Referenced by Creature::DoFleeToGetAssistance(), AuraEffect::HandleAuraModDecreaseSpeed(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), AuraEffect::HandleAuraModIncreaseSpeed(), AuraEffect::HandleAuraModIncreaseSwimSpeed(), AuraEffect::HandleAuraModUseNormalSpeed(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), RemoveCharmedBy(), SetHealth(), SetInCombatState(), SetSpeed(), and UpdateSpeed().

◆ UpdateSplineMovement()

void Unit::UpdateSplineMovement ( uint32  t_diff)
private
595{
596 if (movespline->Finalized())
597 return;
598
599 // xinef: process movementinform
600 // this code cant be placed inside EscortMovementGenerator, because we cant delete active MoveGen while it is updated
601 SplineHandler handler(this);
602 movespline->updateState(t_diff, handler);
603 // Xinef: Spline was cleared by StopMoving, return
604 if (!movespline->Initialized())
605 {
607 return;
608 }
609
610 bool arrived = movespline->Finalized();
611
612 if (arrived)
613 {
615
618 }
619
620 // pussywizard: update always! not every 400ms, because movement generators need the actual position
621 //m_movesplineTimer.Update(t_diff);
622 //if (m_movesplineTimer.Passed() || arrived)
624}
@ UNIT_BYTES_1_OFFSET_ANIM_TIER
Definition: Unit.h:47
Definition: Unit.cpp:574
uint8 GetAnimationType() const
Definition: MoveSpline.h:125
void updateState(int32 difftime, UpdateHandler &handler)
Definition: MoveSpline.h:98
bool HasAnimation() const
Definition: MoveSpline.h:124

References DisableSpline(), Movement::MoveSpline::Finalized(), Movement::MoveSpline::GetAnimationType(), Object::GetTypeId(), Movement::MoveSpline::HasAnimation(), Movement::MoveSpline::Initialized(), IsAlive(), movespline, Object::SetByteValue(), TYPEID_UNIT, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_FIELD_BYTES_1, UpdateSplinePosition(), and Movement::MoveSpline::updateState().

Referenced by Update().

◆ UpdateSplinePosition()

void Unit::UpdateSplinePosition ( )
private
627{
628 //static uint32 const positionUpdateDelay = 400;
629
630 //m_movesplineTimer.Reset(positionUpdateDelay);
632
634 {
636 pos.m_positionX = loc.x;
637 pos.m_positionY = loc.y;
638 pos.m_positionZ = loc.z;
640
641 if (TransportBase* transport = GetDirectTransport())
642 transport->CalculatePassengerPosition(loc.x, loc.y, loc.z, &loc.orientation);
643 }
644
645 // Xinef: this is bullcrap, if we had spline running update orientation along with position
646 //if (HasUnitState(UNIT_STATE_CANNOT_TURN))
647 // loc.orientation = GetOrientation();
648
649 if (GetTypeId() == TYPEID_PLAYER)
650 UpdatePosition(loc.x, loc.y, loc.z, loc.orientation);
651 else
652 ToCreature()->SetPosition(loc.x, loc.y, loc.z, loc.orientation);
653}
void SetPosition(float x, float y, float z, float o)
Definition: Creature.cpp:3036
Position pos
Definition: Object.h:285
float m_positionZ
Definition: Position.h:58
float m_positionX
Definition: Position.h:56
float m_positionY
Definition: Position.h:57
TransportBase * GetDirectTransport() const
Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
Definition: Unit.cpp:18905
Definition: VehicleDefines.h:107
Definition: MoveSpline.h:27
float orientation
Definition: MoveSpline.h:33
Location ComputePosition() const
Definition: MoveSpline.cpp:26
bool onTransport
Definition: MoveSpline.h:127

References Movement::MoveSpline::ComputePosition(), GetDirectTransport(), Object::GetTypeId(), WorldObject::m_movementInfo, Position::m_positionX, Position::m_positionY, Position::m_positionZ, movespline, Movement::MoveSpline::onTransport, Movement::Location::orientation, MovementInfo::TransportInfo::pos, Position::SetOrientation(), Creature::SetPosition(), Object::ToCreature(), MovementInfo::transport, TYPEID_PLAYER, and UpdatePosition().

Referenced by StopMoving(), and UpdateSplineMovement().

◆ UpdateStats()

virtual bool Unit::UpdateStats ( Stats  stat)
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

Referenced by HandleStatModifier().

◆ Whisper() [1/2]

void Unit::Whisper ( std::string_view  text,
Language  language,
Player target,
bool  isBossWhisper = false 
)
virtual

Reimplemented in Player.

21280{
21281 if (!target)
21282 {
21283 return;
21284 }
21285
21287 WorldPacket data;
21288 ChatHandler::BuildChatPacket(data, isBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, language, this, target, text, 0, "", locale);
21289 target->SendDirectMessage(&data);
21290}
LocaleConstant
Definition: Common.h:74
@ CHAT_MSG_MONSTER_WHISPER
Definition: SharedDefines.h:3139
@ CHAT_MSG_RAID_BOSS_WHISPER
Definition: SharedDefines.h:3166
static size_t BuildChatPacket(WorldPacket &data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag, std::string const &senderName="", std::string const &receiverName="", uint32 achievementId=0, bool gmMessage=false, std::string const &channelName="")
Definition: Chat.cpp:192
LocaleConstant GetSessionDbLocaleIndex() const
Definition: WorldSession.h:495

References ChatHandler::BuildChatPacket(), CHAT_MSG_MONSTER_WHISPER, CHAT_MSG_RAID_BOSS_WHISPER, Player::GetSession(), WorldSession::GetSessionDbLocaleIndex(), and Player::SendDirectMessage().

Referenced by spell_yogg_saron_insane_periodic_trigger::spell_yogg_saron_insane_periodic_trigger_SpellScript::HandleDummyEffect(), npc_commandscript::HandleNpcWhisperCommand(), Map::ScriptsProcess(), boss_yoggsaron_voice::boss_yoggsaron_voiceAI::UpdateAI(), and boss_zuramat::boss_zuramatAI::UpdateAI().

◆ Whisper() [2/2]

void Unit::Whisper ( uint32  textId,
Player target,
bool  isBossWhisper = false 
)
virtual

Reimplemented in Player.

21322{
21323 if (!target)
21324 {
21325 return;
21326 }
21327
21328 BroadcastText const* bct = sObjectMgr->GetBroadcastText(textId);
21329 if (!bct)
21330 {
21331 LOG_ERROR("entities.unit", "Unit::Whisper: `broadcast_text` was not {} found", textId);
21332 return;
21333 }
21334
21336 WorldPacket data;
21337 ChatHandler::BuildChatPacket(data, isBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, LANG_UNIVERSAL, this, target, bct->GetText(locale, getGender()), 0, "", locale);
21338 target->SendDirectMessage(&data);
21339}
Definition: ObjectMgr.h:435
std::string const & GetText(LocaleConstant locale=DEFAULT_LOCALE, uint8 gender=GENDER_MALE, bool forceGender=false) const
Definition: ObjectMgr.h:457

References ChatHandler::BuildChatPacket(), CHAT_MSG_MONSTER_WHISPER, CHAT_MSG_RAID_BOSS_WHISPER, getGender(), Player::GetSession(), WorldSession::GetSessionDbLocaleIndex(), BroadcastText::GetText(), LANG_UNIVERSAL, LOG_ERROR, Player::SendDirectMessage(), and sObjectMgr.

◆ Yell() [1/2]

◆ Yell() [2/2]

void Unit::Yell ( uint32  textId,
WorldObject const *  target = nullptr 
)
virtual

Reimplemented in Player.

21312{
21313 Talk(textId, CHAT_MSG_MONSTER_YELL, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), target);
21314}

References CHAT_MSG_MONSTER_YELL, CONFIG_LISTEN_RANGE_YELL, and sWorld.

Member Data Documentation

◆ _charmThreatInfo

CharmThreatMap Unit::_charmThreatInfo
protected

Referenced by RemoveCharmedBy().

◆ _instantCast

bool Unit::_instantCast
protected

◆ _isWalkingBeforeCharm

bool Unit::_isWalkingBeforeCharm
private

Are we walking before we were charmed?

Referenced by SetCharm(), and Unit().

◆ _lastDamagedTargetGuid

◆ _lastExtraAttackSpell

uint32 Unit::_lastExtraAttackSpell
private

◆ _lastLiquid

LiquidTypeEntry const* Unit::_lastLiquid
protected

◆ _oldFactionId

uint32 Unit::_oldFactionId
private

faction before charm

Referenced by RemoveCharmedBy(), SetCharmedBy(), and Unit().

◆ _redirectThreatInfo

◆ bRequestForcedVisibilityUpdate

◆ extraAttacksTargets

std::unordered_map<ObjectGuid , uint32 > Unit::extraAttacksTargets
private

Referenced by AddExtraAttacks(), and Update().

◆ i_AI

◆ i_disabledAI

UnitAI * Unit::i_disabledAI
protected

Referenced by UpdateCharmAI().

◆ i_motionMaster

MotionMaster* Unit::i_motionMaster
protected

Referenced by GetMotionMaster(), and ~Unit().

◆ IsAIEnabled

◆ m_appliedAuras

◆ m_applyResilience

bool Unit::m_applyResilience
protected

◆ m_attackers

◆ m_attacking

Unit* Unit::m_attacking
protected

◆ m_attackTimer

◆ m_auraModifiersGroup

◆ m_auraStateAuras

◆ m_auraUpdateIterator

AuraMap::iterator Unit::m_auraUpdateIterator
protected

◆ m_AutoRepeatFirstCast

bool Unit::m_AutoRepeatFirstCast
protected

◆ m_baseSpellCritChance

◆ m_canDualWield

bool Unit::m_canDualWield

◆ m_canModifyStats

bool Unit::m_canModifyStats
protected

◆ m_charmInfo

◆ m_cleanupDone

bool Unit::m_cleanupDone
private

◆ m_CombatTimer

uint32 Unit::m_CombatTimer
private

◆ m_ComboPointHolders

std::unordered_set<Unit*> Unit::m_ComboPointHolders
private

◆ m_comboPoints

int8 Unit::m_comboPoints
private

◆ m_comboTarget

◆ m_Controlled

◆ m_ControlledByPlayer

bool Unit::m_ControlledByPlayer

◆ m_CreatedByPlayer

bool Unit::m_CreatedByPlayer

◆ m_createStats

float Unit::m_createStats[MAX_STATS]
protected

◆ m_currentSpells

◆ m_deathState

◆ m_delayed_unit_ai_notify_timer

uint16 Unit::m_delayed_unit_ai_notify_timer

Referenced by Unit(), and Update().

◆ m_delayed_unit_relocation_timer

◆ m_Diminishing

◆ m_duringRemoveFromWorld

bool Unit::m_duringRemoveFromWorld
private

◆ m_dynObj

◆ m_Events

EventProcessor Unit::m_Events

Referenced by _ApplyAura(), _ExitVehicle(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::Activate(), Spell::AddUnitTarget(), spell_sindragosa_ice_tomb::spell_sindragosa_ice_tomb_AuraScript::AfterApply(), Creature::CallAssistance(), CastDelayedSpellWithPeriodicAmount(), CleanupBeforeRemoveFromMap(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::DoAction(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::DoAction(), boss_cthun::DoAction(), boss_ouro::Emerge(), SpellEvent::Execute(), BattleExperienceEvent::Execute(), UtherBatteredHiltEvent::Execute(), TriggerWickedSpirit::Execute(), lapseTeleport::Execute(), PartyTimeEmoteEvent::Execute(), npc_xt002_boombot::npc_xt002_boombotAI::Explode(), Creature::ForcedDespawn(), WorldSession::HandleAuctionListOwnerItems(), spell_item_party_time::HandleEffectApply(), spell_alar_flame_quills::spell_alar_flame_quills_AuraScript::HandlePeriodic(), spell_ayamiss_swarmer_teleport_trigger::HandleScript(), npc_pet_mage_mirror_image::InitializeAI(), Totem::InitSummon(), npc_swarm_scarab::npc_swarm_scarabAI::JustDied(), npc_nerubian_burrower::npc_nerubian_burrowerAI::JustDied(), npc_gunship::npc_gunshipAI::JustDied(), npc_xt002_boombot::npc_xt002_boombotAI::JustDied(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::JustDied(), boss_kiljaeden::boss_kiljaedenAI::JustSummoned(), boss_hazzarah::JustSummoned(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustSummoned(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustSummoned(), boss_prince_valanar_icc::boss_prince_valanarAI::JustSummoned(), boss_sindragosa::boss_sindragosaAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::JustSummoned(), npc_risen_archmage::npc_risen_archmageAI::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustSummoned(), boss_lady_vashj::boss_lady_vashjAI::JustSummoned(), Creature::ModifyThreatPercentTemp(), boss_ebonroc::boss_ebonrocAI::MovementInform(), boss_ayamiss::MovementInform(), boss_essence_of_suffering::boss_essence_of_sufferingAI::MovementInform(), boss_essence_of_desire::boss_essence_of_desireAI::MovementInform(), gunship_npc_AI::MovementInform(), npc_gunship_boarding_addAI::MovementInform(), boss_ghazan::MovementInform(), spell_halion_twilight_realm::spell_halion_twilight_realm_AuraScript::OnApply(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), spell_halion_leave_twilight_realm::spell_halion_leave_twilight_realm_AuraScript::OnRemove(), at_cthun_stomach_exit::OnTrigger(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnUnitDeath(), npc_hyldsmeet_protodrake::npc_hyldsmeet_protodrakeAI::PassengerBoarded(), npc_hive_zara_swarmer::PathEndReached(), Spell::prepare(), Spell::RecalculateDelayMomentForDst(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::Reset(), NPCStaveQuestAI::ResetState(), npc_gunship_boarding_addAI::SetData(), boss_the_beast::boss_thebeastAI::SetData(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::SummonedCreatureDies(), TempSummon::UnSummon(), Totem::UnSummon(), spell_illidari_council_deadly_strike::spell_illidari_council_deadly_strike_AuraScript::Update(), Update(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_anomalus::boss_anomalusAI::UpdateAI(), and boss_magtheridon::boss_magtheridonAI::UpdateAI().

◆ m_extraAttacks

uint32 Unit::m_extraAttacks

◆ m_FollowingRefMgr

FollowerRefMgr Unit::m_FollowingRefMgr
private

Referenced by addFollower().

◆ m_gameObj

◆ m_HostileRefMgr

HostileRefMgr Unit::m_HostileRefMgr
private

◆ m_interruptableAuras

◆ m_interruptMask

◆ m_last_notify_mstime

uint32 Unit::m_last_notify_mstime

◆ m_last_notify_position

◆ m_lastManaUse

uint32 Unit::m_lastManaUse
private

◆ m_lastSanctuaryTime

uint32 Unit::m_lastSanctuaryTime

◆ m_modAttackSpeedPct

◆ m_modAuras

◆ m_modMeleeHitChance

◆ m_modRangedHitChance

◆ m_modSpellHitChance

◆ m_movedByPlayer

◆ m_ObjectSlot

◆ m_ownedAuras

◆ m_petAuras

PetAuraSet Unit::m_petAuras

◆ m_procDeep

int32 Unit::m_procDeep
protected

Referenced by CanProc(), and SetCantProc().

◆ m_race

uint8 Unit::m_race
protected

◆ m_reactiveTimer

uint32 Unit::m_reactiveTimer[MAX_REACTIVE]
protected

◆ m_realRace

uint8 Unit::m_realRace
protected

◆ m_regenTimer

◆ m_removedAuras

AuraList Unit::m_removedAuras
protected

◆ m_removedAurasCount

uint32 Unit::m_removedAurasCount
protected

◆ m_rootTimes

uint32 Unit::m_rootTimes
protected

Referenced by SetRooted(), and Unit().

◆ m_scAuras

AuraList Unit::m_scAuras
protected

Referenced by GetSingleCastAuras().

◆ m_sharedVision

◆ m_speed_rate

float Unit::m_speed_rate[MAX_MOVE_TYPE]
protected

◆ m_spellImmune

◆ m_state

uint32 Unit::m_state
private

◆ m_SummonSlot

◆ m_ThreatMgr

◆ m_threatModifier

float Unit::m_threatModifier[MAX_SPELL_SCHOOL]

◆ m_transform

uint32 Unit::m_transform
protected

Referenced by getTransForm(), setTransForm(), and Unit().

◆ m_unitTypeMask

◆ m_vehicle

◆ m_vehicleKit

Vehicle* Unit::m_vehicleKit
protected

◆ m_visibleAuras

◆ m_weaponDamage

◆ movespline

◆ NeedChangeAI

bool Unit::NeedChangeAI

◆ SafeUnitPointerSet

std::set<SafeUnitPointer*> Unit::SafeUnitPointerSet